the signature of map
is (a -> b) -> [a] -> [b]
, which means that it takes 2 arguments and returns a list.
Yet the following function, which transforms a string into a first letter capitalised clone is wrong:
modernise :: String -> String
modernise s = unwords . map (\m -> [toUpper (head m)] ++ tail m) (words s)
the good version is:
modernise :: String -> String
modernise = unwords . map (\m -> [toUpper (head m)] ++ tail m) . words
the first version is rejected with an error saying: "too many arguments for the map function"
; but I gave 2 arguments (the lambda function and the result of words
) which is the good number of arguments.
can you help me?