 | hspread-0.3: A client library for the spread toolkit | Contents | Index |
|
| Control.Concurrent.Chan.Closeable | | Portability | non-portable (concurrency) | | Stability | experimental | | Maintainer | sanzhiyan@gmail.com |
|
|
|
|
|
| Description |
| Unbounded closeable channels.
|
|
| Synopsis |
|
|
|
|
| The Chan type
|
|
| data Chan t a |
| Chan is an abstract type representing an unbounded FIFO channel.
|
|
|
| data R |
|
|
| data W |
|
|
| Operations
|
|
| newChan :: IO (Chan R a, Chan W a) |
| Build and returns a pair of Chan, data written on the W end can be read from the R end.
|
|
| writeChan :: Chan W a -> a -> IO Bool |
| Write a value to a Chan.
Returns True if successful, False if the channel is closed.
|
|
| closeChan :: Chan W a -> IO Bool |
| Close the Chan, data can be no more written to it.
Returns True if the Chan was already closed.
|
|
| isClosedChan :: Chan t a -> IO Bool |
| Non-blocking check.
|
|
| readChan :: Chan R a -> IO (Maybe a) |
| Read the next value from the Chan.
|Nothing if the Chan is closed.
|
|
| forkChan :: Chan t a -> IO (Chan R a) |
| Forks a Chan: data that will be written (W)
or is yet to be read (R) on the argument, will also be available on the returned channel.
|
|
| unGetChan :: Chan R a -> a -> IO () |
| Put a data item back onto a channel, where it will be the next item read.
|
|
| isEmptyChan :: Chan R a -> IO Bool |
| Returns True if the supplied Chan is empty, i.e. readChan won't block.
|
|
| Stream interface
|
|
| getChanContents :: Chan R a -> IO [a] |
| Return a lazy list representing the contents of the supplied
Chan, much like hGetContents.
|
|
| writeList2Chan :: Chan W a -> [a] -> IO (Maybe [a]) |
| Write an entire list of items to a Chan.
Returning the remainder if the channel has been closed meanwhile.
|
|
| Produced by Haddock version 0.8 |