What causes <<loop>>?

Brent Yorgey byorgey at seas.upenn.edu
Sat Nov 8 12:37:18 EST 2008

On Sat, Nov 08, 2008 at 10:32:38AM -0600, Creighton Hogg wrote:
> Hello,
> So I'm trying to debug an issue that is causing GHC to emit the
> <<loop>> warning.  I was hoping to get more information about what
> exactly that tells me about the kind of problem, other than the
> obvious interpretation that I appear to be getting into some kind of
> infinite loop.  What is GHC detecting when it emits that warning?

In particular, I think when a thunk is being evaluated, it is marked
in some way; if during evaluation an already-marked thunk is
encountered, a loop exception is raised, since it means that thunk
depends on itself.  (I'm hand-waving slightly since I don't actually
know the details.) Obviously this cannot catch all infinite loops, but
it does catch simple ones where no useful work of evaluation can
actually take place.


More information about the Glasgow-haskell-users mailing list