Showing posts with label Haskell. Show all posts
Showing posts with label Haskell. Show all posts

Friday, January 8, 2016

NF, HNF and WHNF

WHNF: a lambda expr or a constructor
HNF: a lambda expr where the function body is a NF
NF: a term that contains no beta regex

A discussion in SO about stack overflow is particularly interesting to me. I thought the strict version of foldl evaluates to NF, but it in fact only evaluates to WHNF. This is why summing up tuples doesn't evaluate the components, another thing I misunderstood.

Thursday, August 20, 2015

Type classes in Haskell

The inter-relationships of the type classes in the standard Haskell libraries:



  • Solid arrows point from the general to the specific; that is, if there is an arrow from Foo to Bar it means that every Bar is (or should be, or can be made into) a Foo.
  • Dotted arrows indicate some other sort of relationship.
  • Monad and ArrowApply are equivalent.
  • Semigroup, Apply and Comonad are greyed out since they are not actually (yet?) in the standard Haskell libraries.
Source: Typeclassopedia

Saturday, July 5, 2014

A History of Haskell: being lazy with class

I recently stumbled across a fascinating paper from the ACM SIGPLAN History of Programming Languages Conference (HOPL’III), 2007: 

http://www.scs.stanford.edu/~dbg/readings/haskell-history.pdf 

Related materials and talks about this paper can be found at Simon Peyton's page.

A collection of online Haskell tutorials:

Learn you a Haskell http://learnyouahaskell-zh-tw.csie.org/
Write you a Haskell http://dev.stephendiehl.com/fun/
What I wish to know when I learned Haskell http://dev.stephendiehl.com/hask/

Monday, February 3, 2014

Functional JavaScript

How experiences in Haskell help writing functional and reusable JavaScript code:
http://seanhess.github.io/2012/02/20/functional_javascript.html

PureScript: writing JavaScript like a Haskell maniac
https://github.com/purescript

Implementing and explaining notions in category theory using JavaScript:
https://jscategory.wordpress.com/


Tuesday, September 24, 2013

My First Nontrivial Haskell Program

:{
let perm x = _perm x []
    _perm [] [] = [[]]
    _perm [] ys = []
    _perm (x:xs) ys = map (\t -> x:t) (_perm (xs++ys) []) ++ _perm xs (x:ys)
:}