[Haskell-beginners] Re: strange take result--explanation?
apfelmus at quantentunnel.de
Thu Mar 12 08:48:58 EDT 2009
Francesco Bochicchio wrote:
>> But I don't understand because it says that 1 [1,2,3] is a single
> Oh yes, because syntactically it looks like you want to apply the function
> '1' to the argument '[1,2,3]',
> the result being '1 [1,2,3]'
Yes, the error messages indicate that GHC is parsing the expression as
(take) - (1 [1,2,3])
and consequently complains that
take :: Int -> [a] -> [a]
is not a number (i.e. an instance of class Num) and that it can't
interpret the inferred type of
1 :: [t] -> (type of take)
as a Num .
More information about the Beginners