ConcurrentUtils-0.4.1.0: Concurrent utilities

Safe HaskellSafe-Inferred
LanguageHaskell98

Control.CUtils.FChan

Description

Functional channels | A channel data type which allows consumers to hold references to different points in a stream at the same time. Elements of a channel are kept alive only so long as there are references pointing before those elements. And producers on a channel are kept alive only so long as there are consumers.

Synopsis

Documentation

data Chan t Source

data DoneReadingException Source

Thrown by the writer function when the garbage collector detects that no one will read it.

Constructors

DoneReadingException 

takeChan :: Chan t -> IO (t, Chan t) Source

Take the first element from a channel, and a channel representing the remainder of the output.

newChan :: IO (t -> IO (), Chan t) Source

Create a new channel. The first return value is a function that can be used to add values to the channel. The second return value is the channel itself.

makeConsumer :: Chan b -> IO (IO b, IO (Chan b)) Source

The first return value is a thunk that returns values from the channel successively, starting from the position of the parameter channel. The second thunk can be used to retrieve the position of the channel after all the reads made using the first thunk.