[Haskell-cafe] Writing guards shorthand

Simon Peyton-Jones simonpj at microsoft.com
Fri Apr 20 07:20:34 EDT 2007


| > # let infer = function | A | B | C -> true; | D | E | F -> false;;
| > val infer : foo -> bool = <fun>
|
|
| Yes, I appreciate what you want, and I know ocaml too :)
|
| I was just talking around the other ways you can achieve it.  I don't
| know if there is a strong reason why haskell doesn't support an
| equivalent syntax.

No, there's no strong reason.  It's just one more feature... and (perhaps surprisingly) Joel is the first person to raise it that I can remember.   Which is not to say that it's unimportant, but it helps to explain why it isn't in the language.

Simon


More information about the Haskell-Cafe mailing list