[Haskell-cafe] if-then-else as rebindable syntax (was Re: Why
does Haskell have the if-then-else syntax?)
Niklas Broberg
niklas.broberg at gmail.com
Thu Jul 27 09:24:00 EDT 2006
On 7/27/06, Doaitse Swierstra <doaitse at cs.uu.nl> wrote:
> Given the ever increasing complexity of Haskell as understood by the
> GHC, I think very
> few people are looking forward to see further complications that do
> not really add much.
>
> 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).
I absolutely agree with you, making Haskell easy to understand for
newcomers is a far more important goal than an esoteric feature like
this. If this cannot be added in a transparent enough way, then it
shouldn't be added. But I don't see why it couldn't be. Have you ever
been bitten by the rebinding feature provided for the do-notation
(without trying to use it that is)? Why should the if-then-else be any
harder?
> If you want to mess around why not call the function "provided" or
> something similar.
Not a bad suggestion.
> In short: you will not make Haskell a lot more popular by attracting
> category theorists, but by making
> transitions from Java and C as smooth and surprise-free as possible
> (and this is already hard enough).
Agreed. A feature like this should certainly not be by default, but
only for advanced users. There should be no surprises.
> So I strongly suggest to leave this to the next major redesign of the
> language.
Well, if you want to redesign the core language, it is always easier
to include features that have been tried out in practice. Hen or egg.
I am not convinced that this is too complicated a feature to be added
to GHC right now -- provided that it can be added in a transparent
way.
/Niklas
More information about the Haskell-Cafe
mailing list