Safe Haskell | Safe-Inferred |
---|
- class SplitTChan i o | i -> o, o -> i where
- writeTChan :: i a -> a -> STM ()
- readTChan :: o a -> STM a
- peekTChan :: o a -> STM a
- tryPeekTChan :: o a -> STM (Maybe a)
- tryReadTChan :: o a -> STM (Maybe a)
- isEmptyTChan :: o a -> STM Bool
- class SplitTChan i o => NewSplitTChan i o where
- newSplitTChan :: STM (i a, o a)
Documentation
class SplitTChan i o | i -> o, o -> i whereSource
A class capturing Chan operations in STM.
writeTChan :: i a -> a -> STM ()Source
Write a value to the in chan.
readTChan :: o a -> STM aSource
Read the next value from the out chan.
peekTChan :: o a -> STM aSource
Get the next value from the TChan
without removing it,
retrying if the channel is empty.
tryPeekTChan :: o a -> STM (Maybe a)Source
A version of peekTChan
which does not retry. Instead it
returns Nothing
if no value is available.
tryReadTChan :: o a -> STM (Maybe a)Source
A version of readTChan
which does not retry. Instead it
returns Nothing
if no value is available.
isEmptyTChan :: o a -> STM BoolSource
class SplitTChan i o => NewSplitTChan i o whereSource
A class for SplitTChan
types that can be instantiated without programmer
input. e.g. the standard haskell TChan
is a member of this class, however
a bounded chan type that took an Int
to define the buffer size would not.
newSplitTChan :: STM (i a, o a)Source