-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | MVars and Channels with distinguished input and output side -- -- MVars and Channels with distinguished input and output side. When -- threads communicate via an MVar or a Chan 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. -- -- This package requires only Haskell 98. -- -- Related packages: -- -- @package concurrent-split @version 0.0.1.1 module Control.Concurrent.Split.Class data In data Out class C chan new :: C chan => IO (chan In a, chan Out a) read :: C chan => chan Out a -> IO a write :: C chan => chan In a -> a -> IO () module Control.Concurrent.Split.Chan data T dir a type In = T In type Out = T Out new :: IO (In a, Out a) read :: Out a -> IO a write :: In a -> a -> IO () instance Control.Concurrent.Split.Class.C Control.Concurrent.Split.Chan.T module Control.Concurrent.Split.MVar data T dir a type In = T In type Out = T Out newEmpty :: IO (In a, Out a) take :: Out a -> IO a tryTake :: Out a -> IO (Maybe a) put :: In a -> a -> IO () tryPut :: In a -> a -> IO Bool instance Control.Concurrent.Split.Class.C Control.Concurrent.Split.MVar.T