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

Simon Marlow marlowsd at gmail.com
Tue Jul 10 09:53:37 CEST 2012


On 09/07/2012 17:32, Mikhail Vorozhtsov wrote:
> On 07/09/2012 09:49 PM, Simon Marlow wrote:
>> On 09/07/2012 15:04, Mikhail Vorozhtsov wrote:
>>> and respectively
>>>
>>> \case
>>>    P1, P2 -> ...
>>>    P3, P4 -> ...
>>>
>>> as sugar for
>>>
>>> \x y -> case x, y of
>>>    P1, P2 -> ...
>>>    P3, P4 -> ...
>>
>> That looks a bit strange to me, because I would expect
>>
>>   \case
>>      P1, P2 -> ...
>>      P3, P4 -> ...
>>
>> to be a function of type (# a, b #) -> ...
> Hm, maybe I put it slightly wrong. Desugaring is really only a means of
> implementation here.

I think the desugaring is helpful - after all, most of the syntactic 
sugar in Haskell is already specified by its desugaring.  And in this 
case, the desugaring helps to explain why the multi-argument version is 
strange.

 > Would you still expect tuples for \case if you
> didn't see the way `case x, y of ...` was implemented (or thought that
> it is a primitive construct)?

Yes, I still think it's strange.  We don't separate arguments by commas 
anywhere else in the syntax; arguments are always separated by whitespace.

Cheers,
	Simon



More information about the Glasgow-haskell-users mailing list