"José A. Lopes" | 23 Oct 23:03 2012
Picon

Help: Main: thread blocked in MVar operation

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.

Here are some specs:
ghc 7.4.2
mtl 2.1.1

If you need any other information please don't hesitate to ask.
Any help is greatly appreciated!

Cheers,
José

--

-- 
José António Branquinho de Oliveira Lopes
Instituto Superior Técnico
Technical University of Lisbon
Joey Adams | 24 Oct 01:01 2012
Picon

Re: Help: Main: thread blocked in MVar operation

On Tue, Oct 23, 2012 at 5:03 PM, "José A. Lopes" <jose.lopes <at> 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

Gmane