(no subject)

Keith Wansbrough Keith.Wansbrough@cl.cam.ac.uk
Wed, 25 Oct 2000 11:54:27 +0100


> The type inferred by the functions  zero = 0  and zero2 = 0.0 
> are 
> 
> Main> :t zero
> zero :: Integer
> 
> Main> :t zero2
> zero2 :: Double
> 
> Is this an error? 
> 
> I think it should give the type Num a => a, or not?
> At least it is more practical. 

Do a search on the various mailing lists (Haskell, Hugs) for
"monomorphism restriction", or look at Section 4.5.5 of the Haskell 98
report.  This is reguarly argued over, but Haskell is intentionally
designed that way.

--KW 8-)


-- 
Keith Wansbrough <kw217@cl.cam.ac.uk>
http://www.cl.cam.ac.uk/users/kw217/
Cambridge University Computer Laboratory.