-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Concurrent Chans as read/write pairs. Also provides generic Chan, Cofunctor classes. -- -- A wrapper around Control.Concurrent.Chan that splits a Chan into a -- pair, one of which allows only read operations, the other write -- operations. -- -- This makes code easier to reason about, allows us to define useful -- instances (Functor and Cofunctor) on the chan pairs. -- -- In addition this package provides a module that defines a pair of -- classes ReadableChan and WritableChan which defines the -- basic methods any Chan type should provide. -- -- To use standard Chans with these polymorphic functions, import as -- follows: -- --
--   import Control.Concurrent.Chan hiding (readChan,writeChan,writeList2Chan)
--   import Control.Concurrent.Chan.Class
--   
-- -- When used alongside standard Chans, the Split module can be imported -- qualified like: -- --
--   import qualified Control.Concurrent.Chan.Split as S
--   
-- -- Note, we do not implement the deprecated unGetChan and isEmptyChan -- functions. -- -- This module is used internally by the simple-actors package. @package chan-split @version 0.1.3 module Data.Cofunctor class Cofunctor f cofmap :: Cofunctor f => (b -> a) -> f a -> f b module Control.Concurrent.Chan.Class -- | A class for Chan types that can be written to. A minimum complete -- instance defines one of writeList2Chan or writeChan class WritableChan c writeList2Chan :: WritableChan c => c a -> [a] -> IO () writeChan :: WritableChan c => c a -> a -> IO () -- | A class for Chan types that can be read from. class ReadableChan c readChan :: ReadableChan c => c a -> IO a instance ReadableChan MVar instance WritableChan MVar instance ReadableChan Chan instance WritableChan Chan module Control.Concurrent.Chan.Split -- | Create corresponding read and write ends of a chan pair. Writes to the -- InChan side can be read on the OutChan side. newSplitChan :: IO (InChan a, OutChan a) -- | The write side of a chan pair data InChan i -- | The read side of a chan pair data OutChan o -- | Return a lazy list representing the contents of the supplied OutChan, -- much like System.IO.hGetContents. getChanContents :: OutChan a -> IO [a] -- | Duplicate an OutChan: the duplicate channel begins empty, but -- data written to the corresponding InChan will appear in both, -- i.e. consuming a value from the copy will have no affect on the values -- in the original OutChan. dupChan :: OutChan a -> IO (OutChan a) instance Functor OutChan instance Cofunctor InChan instance ReadableChan OutChan instance WritableChan InChan