
8 Nov
2007
8 Nov
'07
8:04 a.m.
Fernando Rodriguez
f :: [a] ->[a] ->[a] f (w : ws) = ws : w
Couldn't match expected type `[a] -> [a]' against inferred type `[[a]]' In the expression: ws : w In the definition of `f': f (w : ws) = ws : w
What's Haskell trying to tell me? I'm a newby so please forgive my ignorance.
First that your type signature doesn't match the definition - you claim in the signature that f will take two parameters, but you give it only one (a list) in the definition. That wouldn't be illegal if the right hand side was a function, but it isn't. When you fix that, Haskell will go on to tell you something about the type of (:). :-) -k -- If I haven't seen further, it is by standing in the footprints of giants