-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | TMVars, TVars and TChans with distinguished input and output side -- -- Transactional MVars, Vars and Channels with distinguished input and -- output side. When threads communicate via a TMVar, a TVar or a TChan -- there are often clearly defined roles, which thread is the sender and -- which one is receiver. We provide wrappers around the standard -- concurrency communication channels that make the distinction clear and -- type safe. -- -- For example, if a function has a parameter of type TChan.In -- then it is sure that it will only write to that channel. Additionally -- if the compiler warns about an unused TChan.Out that was -- created by TChan.new then you know that the receiver part of -- your communication is missing. -- -- See also package concurrent-split for non-transactional -- communication. This package follows the same idea as -- chan-split but is strictly Haskell 98. @package stm-split @version 0.0.2 module Control.Concurrent.STM.Split.Class data In data Out class C chan newIO :: C chan => IO (chan In a, chan Out a) new :: C chan => STM (chan In a, chan Out a) read :: C chan => chan Out a -> STM a write :: C chan => chan In a -> a -> STM () module Control.Concurrent.STM.Split.MVar data T dir a type In = T In type Out = T Out newEmptyIO :: IO (In a, Out a) newEmpty :: STM (In a, Out a) newIO :: a -> IO (In a, Out a) new :: a -> STM (In a, Out a) take :: Out a -> STM a tryTake :: Out a -> STM (Maybe a) put :: In a -> a -> STM () tryPut :: In a -> a -> STM Bool -- | Write value to TMVar and overwrite existing content. It never -- blocks. Please note, that this function is different from the generic -- write, which blocks on TMVars. write :: In a -> a -> STM () instance Control.Concurrent.STM.Split.Class.C Control.Concurrent.STM.Split.MVar.T module Control.Concurrent.STM.Split.Chan data T dir a type In = T In type Out = T Out newIO :: IO (In a, Out a) new :: STM (In a, Out a) read :: Out a -> STM a write :: In a -> a -> STM () writeIO :: In a -> a -> IO () instance Control.Concurrent.STM.Split.Class.C Control.Concurrent.STM.Split.Chan.T