stack
• Bundles useful tools
• Simplifies getting started
Slide 4
Slide 4 text
ghci
• GHC’s REPL
• Commands are vim-like
• See what’s available with `:help`
Slide 5
Slide 5 text
FP Principles
Slide 6
Slide 6 text
First-Class Functions
• Functions are values
• JS: var add1 = function (a) { return a + 1; };
• HS: let add1 = \a -> a + 1
Slide 7
Slide 7 text
Higher-Order Functions
• Functions can be passed to other functions
• JS: [1,2,3].map(add1);
• HS: map add1 [1,2,3]
Slide 8
Slide 8 text
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
Slide 9
Slide 9 text
(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
Slide 10
Slide 10 text
Laziness
• All data isn’t needed all of the time
• head [1..]