On 6 October 2010 11:39, Simon Marlow <marlo...@gmail.com> wrote:
>   Certainly some existing code would fail to parse, e.g.
>   (case e of [] -> \x -> x+1; (x:xs) -> \x -> x+2)

That's definitely a problem. The multi-pattern lambda is nice as I
think it follows naturally from function definitions (indeed, I think
many a Haskeller including myself have written (\x -> k; \y -> l) once
expecting it to work), but problems like this are kind of a deal
breaker.

> A slightly different suggestion from Simon PJ and myself (we agreed on
> something syntax-related :-) is the following:
>
>  \case 1 -> f
>        2 -> g
> ...
>  \case { 1 -> f; 2 -> g }
>

+1

I like this because it has exactly the same properties of Max's
case-of, but is shorter and still reads with sense.

I created a poll about for/against the case-of idea, but it seems,
just from the messages here, unanimous that people *do* want something
like this, mostly to solve the unnecessary/dummy formal parameters
problem.
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to