[Haskell-beginners] infinite type

Imants Cekusins imantc at gmail.com
Sun Jan 3 20:01:41 UTC 2016


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/beginners/attachments/20160103/a738613e/attachment-0001.html>


More information about the Beginners mailing list