Skip to content

Implement lambda-case/lambda-if

I put together a patch for this Haskell' proposal (http://hackage.haskell.org/trac/haskell-prime/ticket/41)

    Prelude> (if then "Haskell" else "Cafe") False
    "Cafe"
    Prelude> (case of 1 -> "One"; _ -> "Not-one") 1
    "One"

There seems to be some support for integrating this proposal into GHC (see http://permalink.gmane.org/gmane.comp.lang.haskell.cafe/81366)

The attached patches implement the feature, test it and document it.

See also the wiki page LambdasVsPatternMatching.

Edited by Simon Peyton Jones
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information