#4535: Add tryReadChan to Chan
---------------------------------+------------------------------------------
Reporter: mitar | Owner:
Type: proposal | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 7.1
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Comment(by simonmar):
`tryReadChan` itself looks ok to me.
If `tryModifyMVar` were to be public, I'd expect its type to be
{{{
tryModifyMVar :: MVar a -> (a -> IO (a, b)) -> IO (Maybe b)
}}}
but I can see why you used instead
{{{
tryModifyMVar :: MVar a -> (a -> IO (a, Maybe b)) -> IO (Maybe b)
}}}
because the former would require an extra `Control.Monad.join`, whereas
the latter has it "built-in".
`tryReadMVar` looks like the right thing, I wouldn't object to that going
in `Control.Concurrent.MVar`.
What is the purpose of the INLINE pragma?
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/4535#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs