Lambda case

  • Example
    • Case
    • Lambda
    • Lambda-case

The LambdaCase GHC extension introduces a kind of expression that is something of a cross between a case expression and a lambda expression. A lambda case expression is written using the \case keyword, which does not exist in standard Haskell.

When we have a combination of a lambda and a case expression that looks like this:

\x -> case x of {- ... -}

we can rewrite slightly more tersely as a lambda-case, like this:

\case {- ... -}

LambdaCase has been in GHCGHC documentation for LambdaCase since version 7.6.1.

Sign up for access to the full page, plus the complete archive and all the latest content.