[Haskell-cafe] lambda case

Jon Fairbairn jon.fairbairn at cl.cam.ac.uk
Mon Dec 3 16:17:50 CET 2012


Brandon Allbery <allbery.b at gmail.com> writes:

> On Sat, Dec 1, 2012 at 5:30 AM, Roman Cheplyaka <roma at ro-che.info> wrote:
>
>> I find this discussion useful — there are some interesting points
>> (splitting "case of" into two parts) that I don't remember reading in the
>> original thread (but maybe it's just me).
>>
>
> Mentioned twice that I recall, as treating 'of' as a lambda and as '\of'.

I’m not quite sure what treating “of” as lambda means, and \of
raises the some of the same objections as \case.

Up until the introduction of “lambda-case”, \ was a clear
indication that what was coming next was a pattern that would
bind variables (except in degenerate cases, but anyone who
writes something like \Nothing -> e should be taken out and sho-
wn why it’s a bad idea).

>  It got somewhat short shrift, likely because while it makes sense from an
> existing language syntax viewpoint, it makes little to none from a
> readability standpoint.

Of the available alternatives, it makes the most linguistic
sense. If you can’t read the subtext for that sentence, try
again :-) In the design I was suggesting, “of” is in no sense a
lambda, it simply introduces a list of alternative patterns
exactly as it does in the original design of case … of {alts}.
Arguing about whether “of” is the right keyword here without
arguing that case… of… should have different keywords is
inconsistent, and arguing for a change of those keywords really
would be fussing about the colour of the bikeshed after it was
painted.


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





More information about the Glasgow-haskell-users mailing list