-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Some extra kit for Chans -- -- Some extra kit for Chans @package chan @version 0.0.3 module Control.Concurrent.Chan.Extra type DiffNanosec = Int debounceStatic :: DiffNanosec -> Chan a -> IO (Chan a, Async ()) -- | Like debounce, but lossless throttleStatic :: DiffNanosec -> Chan a -> IO (Chan a, Async ()) intersperseStatic :: DiffNanosec -> IO a -> Chan a -> IO (Chan a, Async (), Async ()) module Control.Concurrent.Chan.Scope data Scope Read :: Scope Write :: Scope ReadWrite :: Scope class Readable (a :: Scope) class Writable (a :: Scope) instance Control.Concurrent.Chan.Scope.Writable 'Control.Concurrent.Chan.Scope.Write instance Control.Concurrent.Chan.Scope.Writable 'Control.Concurrent.Chan.Scope.ReadWrite instance Control.Concurrent.Chan.Scope.Readable 'Control.Concurrent.Chan.Scope.Read instance Control.Concurrent.Chan.Scope.Readable 'Control.Concurrent.Chan.Scope.ReadWrite module Control.Concurrent.Chan.Typed newtype ChanRW (scope :: Scope) a ChanRW :: (Chan a) -> ChanRW a readOnly :: Readable scope => ChanRW scope a -> ChanRW 'Read a writeOnly :: Writable scope => ChanRW scope a -> ChanRW 'Write a allowReading :: Writable scope => ChanRW scope a -> ChanRW 'ReadWrite a allowWriting :: Readable scope => ChanRW scope a -> ChanRW 'ReadWrite a newChanRW :: IO (ChanRW 'ReadWrite a) writeChanRW :: Writable scope => ChanRW scope a -> a -> IO () readChanRW :: Readable scope => ChanRW scope a -> IO a dupChanRW :: Writable scopeIn => Readable scopeOut => ChanRW scopeIn a -> IO (ChanRW scopeOut a) module Control.Concurrent.Chan.Typed.Extra type DiffNanosec = Int debounceStatic :: DiffNanosec -> ChanRW 'Read a -> IO (ChanRW 'Write a, Async ()) -- | Like debounce, but lossless throttleStatic :: DiffNanosec -> ChanRW 'Read a -> IO (ChanRW 'Write a, Async ()) intersperseStatic :: DiffNanosec -> IO a -> ChanRW 'Read a -> IO (ChanRW 'Write a, Async (), Async ()) module Control.Concurrent.STM.TChan.Extra type DiffNanosec = Int -- | Note: In this model, even though we are using STM, a write to the -- outgoing channel does not imply a transactional write to the output -- channel; they are separated between a run IO layer, which means we -- cannot atomically debounce or interleave the system (because that -- depends on real-world time). debounceStatic :: DiffNanosec -> TChan a -> IO (TChan a, Async ()) throttleStatic :: DiffNanosec -> TChan a -> IO (TChan a, Async ()) intersperseStatic :: DiffNanosec -> IO a -> TChan a -> IO (TChan a, Async (), Async ()) module Control.Concurrent.STM.TChan.Typed newtype TChanRW (scope :: Scope) a TChanRW :: (TChan a) -> TChanRW a readOnly :: Readable scope => TChanRW scope a -> TChanRW 'Read a writeOnly :: Writable scope => TChanRW scope a -> TChanRW 'Write a allowReading :: Writable scope => TChanRW scope a -> TChanRW 'ReadWrite a allowWriting :: Readable scope => TChanRW scope a -> TChanRW 'ReadWrite a newTChanRW :: STM (TChanRW 'ReadWrite a) writeTChanRW :: Writable scope => TChanRW scope a -> a -> STM () unGetTChanRW :: Writable scope => TChanRW scope a -> a -> STM () isEmptyTChanRW :: Readable scope => TChanRW scope a -> STM Bool readTChanRW :: Readable scope => TChanRW scope a -> STM a tryReadTChanRW :: Readable scope => TChanRW scope a -> STM (Maybe a) peekTChanRW :: Readable scope => TChanRW scope a -> STM a tryPeekTChanRW :: Readable scope => TChanRW scope a -> STM (Maybe a) newBroadcastTChanRW :: STM (TChanRW 'Write a) dupTChanRW :: Writable scopeIn => Readable scopeOut => TChanRW scopeIn a -> STM (TChanRW scopeOut a) cloneTChanRW :: Writable scopeIn => Readable scopeOut => TChanRW scopeIn a -> STM (TChanRW scopeOut a) module Control.Concurrent.STM.TChan.Typed.Extra type DiffNanosec = Int -- | Note: In this model, even though we are using STM, a write to the -- outgoing channel does not imply a transactional write to the output -- channel; they are separated between a run IO layer, which means we -- cannot atomically debounce or interleave the system (because that -- depends on real-world time). debounceStatic :: DiffNanosec -> TChanRW 'Read a -> IO (TChanRW 'Write a, Async ()) throttleStatic :: DiffNanosec -> TChanRW 'Read a -> IO (TChanRW 'Write a, Async ()) intersperseStatic :: DiffNanosec -> IO a -> TChanRW 'Read a -> IO (TChanRW 'Write a, Async (), Async ())