Because of precedence rules. Application has highest precedence; $
- lowest.
head . words “one two three four”
is parsed as head . (words “one two three four”)
i.e. words
applied on a string must produce a function (as demanded by (.)
). But that's not the type that words
has:
Prelude> :t words
words :: String -> [String]
head . words $ “one two three four”
on the other hand, is parsed as (head . words) “one two three four”
and the types fit.