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

Simon Marlow marlowsd at gmail.com
Mon Jul 9 16:49:01 CEST 2012


On 09/07/2012 15:04, Mikhail Vorozhtsov wrote:
> Hi Simon.
>
> On 07/09/2012 08:23 PM, Simon Marlow wrote:
>> On 07/07/2012 16:07, Strake wrote:
>>> On 07/07/2012, Jonas Almström Duregård <jonas.duregard at chalmers.se>
>>> wrote:
>>>> Couldn't we use \\ for multi-case lambdas with layout?
>>>>
>>>> If not, these are my preferences in order (all are single argument
>>>> versions):
>>>> 1: Omission: "case of". There seems to be some support for this but it
>>>> was not included in the summary.
>>>> 2: Omission with clarification: "\case of"
>>>> 3: "\of"  - but I think this is a little weird. It's nice to have
>>>> short keywords but not at the expense of intuition. The goal here is
>>>> to drop the variable name not the case keyword, right?
>>>>
>>>> Regards,
>>>> Jonas
>>>
>>> Well, since this is now suddenly a ranked-choice election, I shall
>>> re-cast my vote:
>>
>> I think some misunderstanding has crept in - we're not planning to count
>> votes or anything here.  If you have new suggestions or know of reasons
>> for/against existing proposals then please post, otherwise there's no
>> need to post just to express your personal preference.
> 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 #) -> ...

I like this.

> 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 #) -> ...

Cheers,
	Simon



More information about the Glasgow-haskell-users mailing list