
Is there a particular reason that LambdaCase does not support muliple patterns? Specifically I am suggesting that \case { pA1 pA2 pA3 -> eA, ... } be sugar for \freshName1 freshName2 freshName3 -> case freshName1 freshName2 freshName3 of { pA1 pA2 pA3 -> eA, ... } Is there some technical reason that prevents it? Tom

On Tue, Jan 27, 2015 at 12:38:25PM +0000, Tom Ellis wrote:
Is there a particular reason that LambdaCase does not support muliple patterns? Specifically I am suggesting that
\case { pA1 pA2 pA3 -> eA, ... }
be sugar for ... Is there some technical reason that prevents it?
Correction to my sugar: \freshName1 freshName2 freshName3 -> case (freshName1, freshName2, freshName3) of { (pA1, pA2, pA3) -> eA, ... } (or in practice probably an unboxed tuple)

On 27/01/15 14:38, Tom Ellis wrote:
Is there a particular reason that LambdaCase does not support muliple patterns? Specifically I am suggesting that
\case { pA1 pA2 pA3 -> eA, ... }
be sugar for
\freshName1 freshName2 freshName3 -> case freshName1 freshName2 freshName3 of { pA1 pA2 pA3 -> eA, ... }
Is there some technical reason that prevents it?
That'd introduce a syntactic ambiguity; pA1 pA2 pA3 is a valid pattern by itself (as in "Just True"). Roman

On Tue, Jan 27, 2015 at 03:05:05PM +0200, Roman Cheplyaka wrote:
On 27/01/15 14:38, Tom Ellis wrote:
Is there a particular reason that LambdaCase does not support muliple patterns? Specifically I am suggesting that
\case { pA1 pA2 pA3 -> eA, ... }
be sugar for
\freshName1 freshName2 freshName3 -> case freshName1 freshName2 freshName3 of { pA1 pA2 pA3 -> eA, ... }
Is there some technical reason that prevents it?
That'd introduce a syntactic ambiguity; pA1 pA2 pA3 is a valid pattern by itself (as in "Just True").
Ah good point indeed. I was imagining that my proposal would bring \case in line with function pattern binds, but the latter need parens around `Just True`. I still think this would be a decent idea for a different language, but not, it seems, for Haskell. Thanks for pointing it out. Tom
participants (2)
-
Roman Cheplyaka
-
Tom Ellis