[Haskell-cafe] Syntax for lambda case proposal could be "\of"

Dan Weston westondan at imageworks.com
Wed Aug 15 17:35:15 EDT 2007


I came really late to this discussion, so I assume someone has already 
proposed using (Control.Applicative.<|>) to select the first matching 
pattern of an unnamed cased object.

Can someone point me to where that was proposed and why it was rejected?

Dan Weston

Isaac Dupree wrote:
> Duncan Coutts wrote:
>> On Wed, 2007-08-15 at 18:23 +0100, Brian Hulley wrote:
>>
>>> Therefore I propose:
>>>
>>>     \of
>>>         alts
>>>
>>> which doesn't suffer this problem since the keyword "of" can never 
>>> follow a '\' in the existing grammar.
>>
>> Or how about:
>>
>> \case of
>>     alts
>>
>> which seems clearer to me.
>>
>> Similarly, the keyword "case" can never follow a '\' in the existing
>> grammar.
>>
>> Mind you, this doesn't seem to save much over
>>
>> \x -> case x of
>>     alts
> 
> It saves the writer using an explicit name which must be unique and the 
> reader determining that the name is not used deeper in the expressions. 
> (and a "->").  I tend to find myself wanting this after already having 
> written a 'case' and decided I don't need/want a name for the thing 
> being 'cased'.  I wouldn't mind "case of", "\of" or "\case of", for 
> using it.
> 
> Allowing multiple arguments - is syntactically difficult to reconcile 
> with 'case' because it restricts what single-argument forms can be used? 
> Such as:
>  >   case foo of Just n -> n
> is allowed but
>  > f Just n = n
> isn't.
> 
> 
> Isaac
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
> 
> 




More information about the Haskell-Cafe mailing list