Prelude> let f g = g . g
Prelude> let sum x y = x + y

Prelude> let sum' = f sum

    Occurs check: cannot construct the infinite type: a ~ a -> a

If f and sum were defined in a module, given a signature, I suppose this would compile.

Similarly, sometimes valid functions defined within function body without signatures sometimes make compiler complain. Once such functions are moved to top (module) level and given a signature, compiler is happy.