[Haskell-cafe] lambda case (was Re: A big hurray for lambda-case (and all the other good stuff))

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Thu Nov 29 18:49:53 CET 2012


Ben Franksen <ben.franksen at online.de> writes:

> just wanted to drop by to say how much I like the new lambda case extension. 
> I use it all the time and I just *love* how it relieves me from conjuring up 
> dummy variables, which makes teh code not only esier to write but also to 
> read.

> […] should *definitely* go into Haskell'13.

As I was opposed to the suggestion for lambda case I didn’t
really follow the discussion of the syntax, but I’m puzzled by
the choice. To me it seems obvious that if we are going to do
this (as opposed to something more decomposable like
lambda-match), we should do it simply by making the “case exp”
part of a case expression optional. So the syntax for lambda-
case would be

   of {alts…}

and we would then describe

   case e of {…}

as syntactic sugar for

   (of {…}) (e)

Doing it this way doesn’t introduce any new syntactic elements
and has fewer tokens at the point of use.

I don’t see any need for a \ in the syntax: this is a functional
language we are talking about after all. Once we know that “of”
introduces a function, that should be enough.

-- 
Jón Fairbairn                                 Jon.Fairbairn at cl.cam.ac.uk




More information about the Haskell-Cafe mailing list