basvandijk/lifted-base — Issue #1: Control.Concurrent.MVar.Lifted.modifyMVar does not put back value on Control.Monad.Error.throwError
Author: TonyGen
Created: 2011-12-15 03:28:27+00:00
State: open

Reproduce bug in ghci as follows:

> import Control.Monad.Error
> import Control.Concurrent.MVar.Lifted
> var <- newMVar 0 :: IO (MVar Int)
> runErrorT (modifyMVar_ var (return . (+ 1)) :: ErrorT String IO ())
Right ()
> runErrorT (readMVar var :: ErrorT String IO Int)
Right 1
> runErrorT (modifyMVar_ var (\_ -> throwError "err") :: ErrorT String IO ())
Left "err"
> runErrorT (readMVar var :: ErrorT String IO Int)
NEVER RETURNS

I think the fix will require a new abstraction in control-monad.

The mongoDB package is currently suffering from this bug.

Thanks,
Tony