defaults
Malcolm Wallace
Malcolm.Wallace at cs.york.ac.uk
Mon Jan 15 10:55:52 EST 2007
Simon Marlow <simonmar at microsoft.com> wrote:
> Is your proposal supposed to be backwards compatible with Haskell 98
> for programs that don't have default declarations?
Yes, it is supposed to be backwards compatible.
> If so, then I offer a counter example:
> toRational pi
> will default pi to Double in Haskell 98, but will be an error under
> your proposal, because the two constraints (Real and Floating)
> disagree on the default.
Well spotted. So there are some expressions that are defaulted in H'98
but would not pass type-checking with my proposal.
(1) Are examples like this common? I am guessing not. You mention
Enum/Fractional combinations, but arguably Float and Double do not
belong in Enum anyway.
(2) The new rule is conservative - it does not silently change the
semantics, but it does reject more programs. Such programs are
easily fixed by adding a type signature.
If these two points are valid, then I think the slight loss of backward
compatibility is acceptable?
Regards,
Malcolm
More information about the Haskell-prime
mailing list