[Haskell-cafe] MVar which can not be null ?

s9gf4ult s9gf4ult at gmail.com
Mon Mar 18 09:07:42 CET 2013


18.03.2013 13:26, Alexander V Vershilov ?????:

I can not use atomicModifyIORef because it works with pure computation

atomicModifyIORef :: IORef
<http://hackage.haskell.org/packages/archive/base/latest/doc/html/Data-IORef.html#t:IORef>
a -> (a -> (a, b)) -> IO
<http://hackage.haskell.org/packages/archive/base/latest/doc/html/System-IO.html#t:IO>
b

nor STM, becuase IO is not acceptable inside STM transaction.

I just need some thread-safe blocking variable like MVar

modifyMVar :: MVar
<http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Control-Concurrent-MVar.html#t:MVar>
a -> (a -> IO
<http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/System-IO.html#t:IO>
(a, b)) -> IO
<http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/System-IO.html#t:IO>
b
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130318/a3cd2916/attachment.htm>


More information about the Haskell-Cafe mailing list