
12 Nov
2009
12 Nov
'09
3:37 a.m.
Hi! I have a problem with understanding some types given by ghc and hugs. The file loaded is: f1 = \x -> x * 2 f2 x = x * 2 After they are loaded I get the following from ghci *Main> :t f1 f1 :: Integer -> Integer *Main> :t f2 f2 :: (Num a) => a -> a *Main> :t \x -> x * 2 \x -> x * 2 :: (Num a) => a -> a I do not understand why f1 is given Integer -> Integer as a type and not the polymorphic (Num a) => a -> a. I believed that f1, f2 and the lambda expression should all have the same type. Similar output to that above is given by Hugs. Thanks, Dag Hovland