Inferred type is not general enough

Cagdas Ozgenc [email protected]
Wed, 8 Aug 2001 13:16:19 +0300


Hi,

The following function generates a type error.

headColumnwise :: [a] -> a
headColumnwise line = [ head line | line <- p ]

ERROR ch6ex1.hs:14 - Inferred type is not general enough
*** Expression    : headColumnwise
*** Expected type : [a] -> a
*** Inferred type : [[a]] -> [a]

If I change the type of the function to 

[[a]] -> [a]

it compiles fine. Isn't [a]->a the most general type here?

Thanks