Hi, 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. Best regards, Paula ********************************************************************* Centro de Matematica, Facultad de Ciencias Igua 4225 esq. Mataojo, CP 11400. Montevideo, Uruguay severi@cmat.edu.uy Tel. 598 2 5252183 (int. 128) Fax 598 2 5220653 *********************************************************************
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
participants (2)
-
Keith Wansbrough -
Paula Severi