[Haskell-beginners] Type inference question

Zachary Turner divisortheory at gmail.com
Sun Mar 29 12:14:00 EDT 2009


Given the following two function definitions:

let func4 l = map (\y -> y+2) (filter (\z -> z `elem` [1..10]) (5:l))
let func4_pf = map (+2) . filter (`elem` [1..10]) . (5 :)

which are equivalent, why does the first one have a type of

func4 :: (Num a, Enum a) => [a] -> [a]

while the second one has a type of

func4_pf :: [Integer] -> [Integer]

Shouldn't the types be the same?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20090329/7053aca1/attachment-0001.htm


More information about the Beginners mailing list