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

Simon Peyton-Jones simonpj at microsoft.com
Tue Jul 10 08:53:27 CEST 2012


| I strongly favor a solution where lambda-case expressions start with \,
| because this can be generalized to proc expressions from arrow syntax
| simply by replacing the \ with proc.
| 
| Take, for example, the following function definition:
| 
|     f (Left  x) = g x
|     f (Right y) = h y
| 
| Now, let’s make an arrow version of it:
| 
|     f = proc e -> case e of
|             Left  x -> g -< x
|             Right y -> h -< y
| 
| It would be great if we could write something like this instead:
| 
|     f = proc of
|             Left  x -> g -< x
|             Right y -> h -< y

I don't think I was aware of the proc part.

I think it's very helpful if lambdas start with a lambda, which to me suggests \case.  I'm not keen on \of; "case" says "case analysis" more clearly. But you presumably do not want \proc, because proc is the lambda. So that would leave use with "\case" and "proc of" as the two constructs.  Perhaps the lesser of the evils, but a bit inconsistent.

Simon


More information about the Glasgow-haskell-users mailing list