[Haskell-cafe] Syntax for lambda case proposal could be "\of"
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?
Isaac Dupree wrote:
> Duncan Coutts wrote:
>> On Wed, 2007-08-15 at 18:23 +0100, Brian Hulley wrote:
>>> Therefore I propose:
>>> which doesn't suffer this problem since the keyword "of" can never
>>> follow a '\' in the existing grammar.
>> Or how about:
>> \case of
>> which seems clearer to me.
>> Similarly, the keyword "case" can never follow a '\' in the existing
>> Mind you, this doesn't seem to save much over
>> \x -> case x of
> 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
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe