Hi Marco,

> g = \x -> x + x
> 
> I get the surprising type
> 
> g :: Integer -> Integer
> 
> Analogously, using "g 2.5" produces the error 
> 
> *** Expression : g 2.5
> *** Type       : Fractional Integer => Integer
> 
> Is this normal or is really a bug? Please note that the Glasgow
> Haskell Compiler seems to identify the correct type for both f and g.

It is normal, although some people consider it a bug. You hit the
dreaded "monomorphism restriction"; see the Haskell report for more
details.

Erik

Reply via email to