<p dir="ltr">Prelude> let f g = g . g<br>
Prelude> let sum x y = x + y</p>
<p dir="ltr">Prelude> let sum' = f sum</p>
<p dir="ltr"> Occurs check: cannot construct the infinite type: a ~ a -> a</p>
<p dir="ltr">If f and sum were defined in a module, given a signature, I suppose this would compile.</p>
<p dir="ltr">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.</p>