Call to arms: lambda-case is stuck and needs your help

Iavor Diatchki iavor.diatchki at gmail.com
Wed Jul 11 23:27:32 CEST 2012


Hello,
I am late to the discussion and this is not entirely on topic, for which I
apologize, but I like the multi-branch case syntax someone mentioned
earlier:

Writing:

> case
>   | p1 -> e1
>   | p2 -> e2
>   | ...

desugars to:

> case () of
>   _ | p1 -> e2
>     | p2 -> e2
>     | ...

-Iavor
PS:  I think it also makes sense to use "if" instead of "case" for this.
 Either way,  I find myself writing these kind of cases quite often, so
having the sugar would be nice.


On Tue, Jul 10, 2012 at 8:55 AM, Chris Smith <cdsmith at gmail.com> wrote:

> On Tue, Jul 10, 2012 at 5:53 AM, Wolfgang Jeltsch
> <g9ks157k at acme.softbase.org> wrote:
> > If we use \case for functions, we should use proc case for arrows;
> > if we use \of for functions, we should use proc of for arrows.
> >
> > By the way, is proc a layout herald already?
>
> No, proc is not a layout herald.  The normal pattern is to use a do in
> the command part of the proc syntax, so it's do that introduces the
> layout.  So "proc of" would fit in cleanly as a way to do proc with
> multiple patterns.  Or "proc case", but again that's just a really
> ugly language wart, IMO uglier than just writing out the longhand
> version of "proc x -> case x of".
>
> --
> Chris Smith
>
> _______________________________________________
> Glasgow-haskell-users mailing list
> Glasgow-haskell-users at haskell.org
> http://www.haskell.org/mailman/listinfo/glasgow-haskell-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/glasgow-haskell-users/attachments/20120711/3c7d2af3/attachment.htm>


More information about the Glasgow-haskell-users mailing list