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

Evan Laforge qdunkan at gmail.com
Wed Oct 6 20:34:18 EDT 2010


> I would also very much like to have multi-argument pattern matching, but in
>
>    \case a b -> ...
>          ...
>
> it sure suggests to me that `a` should be applied to `b` before casing.

I feel like sugar is designed to make a couple of specific uses nicer.
 Being as general and orthogonal as possible is the job of the
primitives.  So I don't mind too much if sugar is a little ad-hoc.
Single argument \case addresses the monadic case problem.  Does
someone have some examples of nice expressions that you need a multi
argument case-lambda for?

I don't mind writing 'case (a, b) of ...' very much.  Seems like you
could get the same effect with 'curry':

(\case { a b -> ... ; a b -> ...}) x y

can be written

(curry $ \case { (a, b) -> ... }) x y

Not as pretty, but still point-free.


More information about the Haskell-Cafe mailing list