[Haskell-cafe] Lambda-case / lambda-if

Nicolas Wu nicolas.wu at gmail.com
Tue Oct 5 02:52:10 EDT 2010

> To repeat, the analogues in SML and Erlang *do* support multiple
> clauses (as well as pattern matching) and the failure of Haskell
> lambdas to do so has always seemed like a weird restriction in a
> language that's usually free of weird restrictions.

I agree with this sentiment. I have never understood why lambdas can't
handle multiple clauses.

> I'd prefer to see something like
>        \ 1 -> f
>        | 2 -> g
> but I'm sure something could be worked out.

This sounds sensible, since the lambda-case clause should really be
about having a lambda with support for cases, not a case statement
that's implicitly surrounded by a lambda. While I think the "case of"
is a good idea, multiple clauses in lambdas seems more canonical to


More information about the Haskell-Cafe mailing list