Ambiguos Types

Simon Peyton-Jones simonpj@microsoft.com
Fri, 8 Jun 2001 04:46:18 -0700


| 1- When I load the following module:
|=20
|     module Foo() where
|     default (Float)
|=20
|     into ghci. 2+3 gives (5::Integer). Should it not give=20
| (5.0::Float). Hugs does.

Good point: it should.  This is really a bug.=20

| 2. class Op a where
|       (%+) :: a -> a -> a
|=20
|    instance Op Integer where
|      (%+) =3D (+)
|=20
|    with the above code:  (2 %+ 3) should be resolved to=20
| Integer type. Could anybody explain why it should not.

Defaulting only appplies for standard classes (check out
the Report). =20

Simon