Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dan Johnson.  Functional language that started development in 1987.  Committee designed language  Pure and Lazy  Compiled or Interpreted  Named after.

Similar presentations


Presentation on theme: "Dan Johnson.  Functional language that started development in 1987.  Committee designed language  Pure and Lazy  Compiled or Interpreted  Named after."— Presentation transcript:

1 Dan Johnson

2  Functional language that started development in 1987.  Committee designed language  Pure and Lazy  Compiled or Interpreted  Named after Haskell Curry (who has nothing to do with the language itself)

3  It should be suitable for teaching, research, and applications, including building large systems.  It should be completely described via the publication of a formal syntax and semantics.  It should be freely available.  It should be usable as a basis for further language research.  It should be based on ideas that enjoy a wide consensus.  It should reduce unnecessary diversity in functional programming languages.

4  Contains a large number of functions for basic operations and list manipulation.  Loaded automatically when ghci is started

5  Everything is considered to be “of a type”.  A functions type is determined by its return type.  The :: literally means “is of the type”.  Groups of similar types are classified into Typeclasses.

6  Type Inference  Haskell will evaluate the parameters to this function and determine that...  Generally considered bad practice to rely on type inference

7  Lists function the same way as in Racket.  Tuples are fixed length types that can contain multiple elements of different types.  By combining lists and tuples, you can create complex and powerful data structures

8  Two parts: declaration and definition  Line 34 uses type variables to make the function polymorphic.  Line 35 uses some of the list functions built into prelude

9  Two ways to pass multiple parameters to a function:  By using a tuple as the parameter  By defining the function as a curried function  Most multi-parameter functions are curried functions

10  Any function that returns a function as its result or accepts a function as a parameter  All curried functions are Higher Order functions because their return type is technically a function

11  Any function that uses type variables (and only type variables) is considered to be a polymorphic function.  Polymorphic functions are easy to create  Type inference automatically defines polymorphic types when applicable.  Allow for one function to cover a broad range of types  Most functions in the Prelude are polymorphic functions

12 If.. Then.. Guards  Syntactically similar to most languages  No “else if” statement, must be done with nested ifs  Written more as a mathematician would write a case structure  More readable, less code to write

13  Is at the core of Haskell because it is so prevalent in mathematics  Simply recall the function with different parameters in the function

14

15  Expressions are only evaluated as much as required to produce the final result.  What does this mean?  Why is it important?  Where can we use it?

16  Pure languages are said to e languages without side effects  What is a side effect?  Is a pure language even possible?  What are the benefits of purity?  What are the cons of purity?

17


Download ppt "Dan Johnson.  Functional language that started development in 1987.  Committee designed language  Pure and Lazy  Compiled or Interpreted  Named after."

Similar presentations


Ads by Google