| The Haskell 98 report, section 4.3.4 states:
|
| [...] 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 [...]
|
| What is the rationale for the second condition, i.e. why is no
| defaulting done when a user-defined class is involved?
The rationale is that choosing a default has semantically
important consequences, so (at least in the view of the people
fixing this aspect of the design) shouldn't happen silently.
After all, a user-defined class might have instances whose
behaviour changes radically when the type changes.
I don't expect you'll buy this argument but that's why it's
there. It would be simple to give GHC a flag to change the rule.
Indeed, you could do so yourself!
Simon