[Haskell-cafe] a simple question about types

Jerzy M jerzmy at gmail.com
Wed Nov 17 13:09:16 EST 2010


Hallo,
let me take this simple function: (2*).
If I check its type
:t (2*)
I'll obtain
(2*) :: (Num a) => a -> a

But now it suffices to write
g = (2*)
and check
:t g
to obtain
g :: Integer -> Integer

One more combination, now I write
h x = (2*) x
and check once more
:t h
to get
h :: (Num a) => a -> a

So my question is: why (in this second example) Integer is inferred?
What makes a difference?

Jerz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20101117/e24a0695/attachment.html


More information about the Haskell-Cafe mailing list