[Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

Simon Peyton-Jones simonpj at microsoft.com
Thu Jul 27 09:53:15 EDT 2006

| We alreday are at a stage where first year students trying to master
| haskell get error messages like
| "Bool is not an instance of the class Num"
| if they accidently write 1 + True (or something equivalent, but less
| obvious).
| If you want to mess around why not call the function "provided" or
| something similar.

Just to be clear, to get rebindable syntax in GHC today, you have to ask
for it explicitly, via

If you use that flag, you'd better know what it means.  It already means
that do-notation uses whatever (>>) and (>>=) are in scope, not
Control.Monad.(>>) etc.  This if-thing is just another example.

No beginner will encounter this complication; they'd have to ask for it.


More information about the Haskell-Cafe mailing list