I am trying to learn Haskell.
We have very simple functions. As I understood all the following are equivalent.
But I don't understand why f2
and f2'
have different types, and why exactly Integer
.
Also, if I specify the type of f2'
manually, it accepts it and works same as f2
.
f x = x + 1
-- f :: Num a => a -> a
f' = \x -> x + 1
-- f' :: Num a => a -> a
f2 a b = a + b
-- f2 :: Num a => a -> a -> a
f2' = \a b -> a + b
-- f2 :: Integer -> Integer -> Integer
f2'' = \a -> \b -> a + b
-- f2 :: Integer -> Integer -> Integer
Any ideas?