Unbounded, element-strict channels. Elements will be evaluated to WHNF on entering the channel. For some concurrency applications, this is more desirable than passing an unevaluted thunk through the channel (for instance, it guarantees the node willl be evaluated to WHNF in a worker thead).
Element-strict channes may potentially use more memory than lazy channels
- data Chan a
- newChan :: NFData a => IO (Chan a)
- writeChan :: NFData a => Chan a -> a -> IO ()
- readChan :: NFData a => Chan a -> IO a
- dupChan :: NFData a => Chan a -> IO (Chan a)
- unGetChan :: NFData a => Chan a -> a -> IO ()
- isEmptyChan :: NFData a => Chan a -> IO Bool
- getChanContents :: NFData a => Chan a -> IO [a]
- writeList2Chan :: NFData a => Chan a -> [a] -> IO ()
Chan: the duplicate channel begins empty, but data written to
either channel from then on will be available from both. Hence this creates
a kind of broadcast channel, where data written by anyone is seen by
Put a data item back onto a channel, where it will be the next item read.