|    Ambiguities in the class Num are most common, so Haskell 
| provides another 
|    way to resolve them---with a default declaration:
|    default (t1 , ... , tn)
|    where n>=0, and each ti must be a monotype for which Num ti holds. 
|                                                   ^^^^^^^^^^
|    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 
|           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|    Each defaultable variable is replaced by the first type in 
| the default list 
|    that is an instance of all the ambiguous variable's 
| classes. It is a 
|    static error if no such type is found."
| 
| Do these become "whatever Num is in scope" when I use 
| -fno-implicit-prelude, and "whatever classes from standard 
| libraries" are in scope? If they don't then I think I'm in a pickle.

I confess that I had forgotten about this.  It's not easy to 
see what a good alternative design would be... I suppose it 
could be "whatever Num is in scope or a subclass thereof", but
what would correspond to "defined in the Prelude or a standard lib"?

An alternative would be to drop the rule altogether with
-fno-implicit-prelude
and let all ambiguous types be defaulted with the specified list of
types.  The motivation for the rules as stated is to avoid excessive 
defaulting, which silently affects the meaning of your program.

As you say, the absence of an obvious design point means I'm 
unlikely to fiddle just now.  If a consensus emerges (and it's not
to hard to do) I'd be willing to fiddle, though.

Simon   
_______________________________________________
Glasgow-haskell-users mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users

Reply via email to