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

Haskell, the most pragmatic functional language

Haskell, the most pragmatic functional language


May 31, 2017

More Decks by Anler

Other Decks in Programming


  1. Functional Programming A. Functions (the real ones, aka pure ones)

    B. Functions as values (higher-order) C. Recursion (the only loop construction)
  2. Functional Language A. Support for functional abstractions B. Support for

    handling side-effects C. Efficient (you don’t pay the abstraction)
  3. • Is more general • Haskell tail recursive functions in

    constant time • Haskell mutual recursive functions in constant time (Monads!)
  4. Deferred types • -fdefer-type-errors Type errors are converted to runtime

    errors (good for ghci sessions) • Type holes put the compiler to work for us main = _
  5. STM Haskell is the best language in the world in

    which to implement an STM • It was originally 100 lines of code, and even now it’s only about 600 lines of C! • It exploits three properties of the language: purity, immutability and laziness • Haskell retries an STM transaction as needed. Immutability allows it to do this fearlessly, and laziness avoids fully evaluating the transaction • STM is harder in other languages. For instance in Clojure you have to manually implement rollback functionality. https://begriffs.com/posts/2016-04-02-software-transactional-memory.html
  6. Data types type classes (type families) data family XList a

    data instance XList Char = XCons Char (XList Char) | XNil data instance XList () = XListUnit Int