Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Beginner's Hands-On with Haskell

Beginner's Hands-On with Haskell

An interactive workshop for newcomers to Haskell and functional programming. Led at the Louisville Haskell Meetup

Shane Logsdon

May 10, 2016
Tweet

More Decks by Shane Logsdon

Other Decks in Programming

Transcript

  1. First-Class Functions • Functions are values • JS: var add1

    = function (a) { return a + 1; }; • HS: let add1 = \a -> a + 1
  2. Higher-Order Functions • Functions can be passed to other functions

    • JS: [1,2,3].map(add1); • HS: map add1 [1,2,3]
  3. Composition • Small functions can be composed into big functions

    • let adder = \a b -> a + b • let add1 = \a -> adder a 1 • Partial application • let add2 = adder 2
  4. (Im)Purity • Referential Transparency: – f(‘a’) will always be ‘b’

    • Effects: – we can't control the world, so let's describe how it will change