On 02-Feb-1999, Jerzy Karczmarczuk <[EMAIL PROTECTED]> wrote:
> At least one thing works badly: the *default*. Before, the
> numbers as 3.1415 were lifted automatically into whatever by
> fromDouble, and polymorphic functions with explicit constants
> were quite comfortable to write. Now the type checker became
> allergic. It demands that I put fromDouble by hand.
>
> So, my question is: is somehow the Fractional class, the fromDouble
> function within it, the default etc. hard-coded into Hugs executable,
> or I have done something silly (which is quite probable).
Yes, the classes defined in the Prelude and the standard library
are treated specially. From the Haskell 1.4 Report:
| 4.3.4 Defaults for Overloaded Numeric Operations
...
| In situations where an ambiguous type is discovered, an ambiguous type
| variable is defaultable if at least one of its classes is a numeric
| class (that is, Num or a subclass of Num) and if all of its classes are
| defined in the Prelude or a standard library
This text remains unchanged in the Haskell 98 Report.
> Do you foresee similar problems with GHC (I didn't test it yet)?
Yes, this is a problem with Haskell in general, not just one specific
implementation.
--
Fergus Henderson <[EMAIL PROTECTED]> | "Binaries may die
WWW: <http://www.cs.mu.oz.au/~fjh> | but source code lives forever"
PGP: finger [EMAIL PROTECTED] | -- leaked Microsoft memo.