[Haskell-cafe] What causes <<loop>>?

Janis Voigtlaender voigt at tcs.inf.tu-dresden.de
Wed Dec 3 04:32:08 EST 2008

Janis Voigtlaender wrote:
> Martin Hofmann wrote:
>> I've already posted this mail on haskell-cafe, but apparently the
>> subject suggested a too simple question, so I try it here again. I am
>> picking up a discussion with the same topic from haskell-users on
>> 8th November. 
> Note that you have been sending to haskell-cafe again. Your recipient
> name says haskell-beginners, but the address is haskell-cafe.
> Anyway, <<loop>> really means a loop in evalutation order, not some
> statebased deadlock (see below).
>> Thunks with reference on themselves was mentioned as main reason for
>> <<loop>>.
>>> A safe recursive definition would be
>>>  let x = Foo (x+1)
>>> However, if you leave out the constructor,
>>>  let x = x + 1
>>> you get a <<loop>> (or a deadlock).
>> Are there any other reasons?
>> I am trying to debug monadic code which stores state information in a
>> record maintaining several Data.Maps, but in vain so far. A state is
>> modified/changed in several steps by a compound function i.e.
>>     changeA $ changeB $ changeC state
>> Could this also lead to a deadlock? 
> I don't think so. At least not in a way that leads to <<loop>>. If you
> get <<loop>> then you really have some infinite recursion in your
> program. Maybe you can track it down with Debug.Trace.trace.
> If so, can I prevent this using CPS?

Oh, that last question was from the original mail, not from my answer.
In any case, I don't think that CPS will help in finding the looping
error in your program.

Dr. Janis Voigtlaender
mailto:voigt at tcs.inf.tu-dresden.de

More information about the Haskell-Cafe mailing list