[Haskell-cafe] Lambda-case / lambda-if
Neil Brown
nccb2 at kent.ac.uk
Tue Oct 5 07:30:23 EDT 2010
On 05/10/10 07:52, Nicolas Wu wrote:
>> I'd prefer to see something like
>> \ 1 -> f
>> | 2 -> g
>> but I'm sure something could be worked out.
>>
> While I think the "case of"
> is a good idea, multiple clauses in lambdas seems more canonical to
> me.
>
Alternatively, we could abandon lambdas and just use lambda-case.
All expressions like \1 -> f become case of 1 -> f
Multi-argument functions are a bit more verbose, as we effectively go
back to single argument functions with manual currying:
\x (C y) -> z becomes: case of {x -> case of {C y -> z}}
There is the small matter of losing backwards compatibility, of course.
But on the plus side, this would reduce the number of constructions in
the language by one. (I think the strictness semantics, etc match up
for this transformation?).
;-)
Thanks,
Neil.
More information about the Haskell-Cafe
mailing list