Tuesday, May 11, 2010

Implicit Folds in Haskell (for those jealous of LISP)

Ever wish you could do things like (+ 3 4 5) from LISP, but in Haskell? Wish no more with the beautiful FoldyList datatype! An example instance for Show is given but feel free to write your own, otherwise the code is next to useless.


  1. I wouldn't call it FoldyCons, as that appears to be confusing. You're not really Cons'ing, so much as applying.

    Maybe, FoldyBuild?

  2. Hmm... how is FoldyCons (+) [3,4,5] better than just writing foldr1 (+) [3,4,5] in the first place?