On Tue, Oct 23, 2012 at 5:03 PM, "José A. Lopes" <jose.lo...@ist.utl.pt> wrote:
> Hey everyone,
>
> I changed my code I now I get the following error message
>     Main: thread blocked indefinitely in an MVar operation
>
> Before the change, I was using the State monad with runState.
> Then, I changed the code to use the StateT monad transformer wrapped around
> IO monad and runStateT.
> And this change introduced the error message.
>
> BTW I am using DoRec extension, maybe it is the source of the problem, but I
> don't know.

See if you can reproduce the problem using a small code sample.  The
problem is likely that your program is trying to use a state value
that hasn't been produced yet.

DoRec uses fixIO for the IO monad.  fixIO passes a callback its own
return value.  It's not magic; it only works if the thunk is not
forced within the callback.

Take a look at how fixIO is implemented:

    
http://hackage.haskell.org/packages/archive/base/latest/doc/html/src/System-IO.html#fixIO

_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to