base-io-access- The IO functions included in base delimited into small, composable classes

Safe HaskellSafe-Inferred



class Access io => ChanAccess io where Source


newChan' :: io (Chan a) Source

Build and returns a new instance of Chan.

writeChan' :: Chan a -> a -> io () Source

Write a value to a Chan.

readChan' :: Chan a -> io a Source

Read the next value from the Chan.

dupChan' :: Chan a -> io (Chan a) Source

Duplicate a 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 everyone else.

(Note that a duplicated channel is not equal to its original. So: fmap (c /=) $ dupChan c returns True for all c.)

getChanContents' :: Chan a -> io [a] Source

Return a lazy list representing the contents of the supplied Chan, much like hGetContents.

writeList2Chan' :: Chan a -> [a] -> io () Source

Write an entire list of items to a Chan.