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

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Mon Jul 9 18:22:30 CEST 2012


Am Montag, den 09.07.2012, 21:04 +0700 schrieb Mikhail Vorozhtsov:
> Could you express your opinion on the case "comma sugar", i.e.
> 
> case x, y of
>    P1, P2 -> ...
>    P3, P4 -> ...
> 
> as sugar for
> 
> case (# x, y #) of
>    (# P1, P2 #) -> ...
>    (# P3, P4 #) -> ...
> 
> and respectively
> 
> \case
>    P1, P2 -> ...
>    P3, P4 -> ...
> 
> as sugar for
> 
> \x y -> case x, y of
>    P1, P2 -> ...
>    P3, P4 -> ...
> 
> ?

Although I wasn’t asked, I want to express my opinion. I think, the use
of the comma is strange. When declaring functions with multiple
arguments, we don’t have commas:

    f Nothing  y = y
    f (Just x) y = x

In lambda expressions for multi-argument functions, we also don’t have
commas:

    \x y -> x + y

Why should we have them when using a case-lambda expression for a
multi-argument function?

Best wishes,
Wolfgang




More information about the Glasgow-haskell-users mailing list