58: Getting Haskell Unit 1 - JSToElm
All Episodes

58: Getting Haskell Unit 1

So here's the deal. How many times have you tried to learn Haskell? We're gonna give it another run at it.

Unit 1


  • Haskell does not allow side effects
  • Must return a value
  • Interesting that you can’t do x++ because every time you do it on the same assigned variable, the output is different!
  • variables as definitions

    • REPL, GHCi, and let up intil 8.0
  • this is related to referential transparence

First-class Functions and Lexical Scope

  • lambda functions, anonymous functions.
  • functions as variables
  • functions as arguments, as return values
  • A tuple is like a list, but can contain multiple types and is a fixed size!
  • Sorting with compare. Haskell gives us GT, LT, and EQ. While JS gives us True or False

Closures / Partial Application

  • Closure is the the idea of ‘capturing’ values to dynamically create functions based on pervious arguments.
  • Capturing a value inside of a lambda function, that often returns a function, is refereed to as a closure.
  • Partial application takes this idea and applies to all functions. If you call a function, but do not give it all the parameters that function takes, Haskell will by default return you a function that takes the remaining parameters.
  • This is a language feature, not something we get in JS. We have .bind() that will partially apply a function, but it also does context assignment for this and you rarely ever need to do both at the same time.
  • http://www.alanturing.net/turing_archive/pages/reference%20articles/The%20Turing-Church%20Thesis.html


Get Programming With Haskell

Philosophy of Software Design by John Ousterhout


Published 15 Nov 2018

A show about learning Elm, Functional Programing, and generally leveling up as a JS developer.
JavaScript To Elm on Twitter