[Haskell-cafe] Lambda-case / lambda-if
Matthew Gruen
wikigracenotes at gmail.com
Wed Oct 6 11:45:57 EDT 2010
On 10/2/10, Christopher Done <chrisdone at googlemail.com> wrote:
> On 2 October 2010 20:23, Max Bolingbroke <batterseapower at hotmail.com> wrote:
>> Do you like this feature and think it would be worth incorporating
>> this into GHC? Or is it too specialised to be of use? If there is
>> enough support, I'll create a ticket and see what GHC HQ make of it.
>
> Nice work! I like it and have wanted it for a while, and I know many
> in the #haskell IRC channel would like it. The case is especially
> useful. Maybe the if is only useful sometimes.
>
+1 for `case of'... I have called for it on many an occasion in
#haskell. Thanks for implementing it, Max!
I primarily see it as a way to remove a point from `\x -> case x of
...', not a way to augment lambdas with pattern matching, like in `\0
-> 1 \n k -> k-1'. I suppose both of them work with monadic casing,
with the `m >>=' trick. `\case' or `\case of' would work okay as well,
the former Simon suggested, but some keywords *somewhere* would be
nice, to avoid a perl-like procession of punctuation. (But the code
golfer in me says otherwise.)
Matt
More information about the Haskell-Cafe
mailing list