errors/CycleInDeclaration.md
CycleInDeclaration Error$ spago repl
> x = x
Error found:
at line 1, column 5 - line 1, column 9
The value of x is undefined here, so this reference is not allowed.
See https://github.com/purescript/documentation/blob/master/errors/CycleInDeclaration.md for more information,
or to contribute content related to this error.
This error occurs when a value refers to itself, or another value in the same binding group, at a point where such a reference would be unavailable because of strict evaluation.
In the example above, it would be incorrect to generate the JavaScript
var x = x;
since then x would be undefined.
Note that cycles can also spring up in much less obvious ways, e.g. if you define one typeclass member using another.
\x -> f x instead of f) or using do-notation, which will introduce a function to the same effect because of bind.Control.Lazy module, and the fix function in particular.