[Haskell-beginners] Inconsistencies in type inference

Stefan Jaax stefan.jaax at googlemail.com
Tue Jun 25 13:22:08 CEST 2013


Hey,

While trying to wrap my head around how type inference works in haskell
I stumbled across the following inconsistency:

If I type
               :t (*)

in ghci, I obtain

                (*) :: Num a => a -> a -> a

But if I write

               let mul = (*)
               :t mul

I get the less generic type signature

               mul :: Integer -> Integer -> Integer

How is this inconsistency explained? After all, I would expect the haskell
compiler to deduce the most generic type possible.

Thanks in advance,
Stefan.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20130625/8cc08a73/attachment.htm>


More information about the Beginners mailing list