Dan Johnson
Functional language that started development in Committee designed language Pure and Lazy Compiled or Interpreted Named after Haskell Curry (who has nothing to do with the language itself)
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.
Contains a large number of functions for basic operations and list manipulation. Loaded automatically when ghci is started
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.
Type Inference Haskell will evaluate the parameters to this function and determine that... Generally considered bad practice to rely on type inference
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
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
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
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
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
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
Is at the core of Haskell because it is so prevalent in mathematics Simply recall the function with different parameters in the function
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?
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?