purescript/purescript — pull request #728 by dylex (2014-11-26 02:41:21+00:00)
Title: Catch erroneous (singleton) recursive definitions

We can't safely bypass the extra immediate reference check even when only one definition is involved in the recursion.

From a discussion on IRC, @NightRa pointed out that calling a class function in an instance declaration can lead to an undefined value (because of the recursive reference to the instance being constructed): http://lpaste.net/115029
Currently extra checks are done to catch and reject these kinds of recursive references, but only when multiple definitions are involved (mutual recursion). This simply performs the same check even when a single definition (in this case the instance) is recursive.

Basic tests pass. Haven't done more extensive testing yet.