Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data ReaderError = ReaderGetError {}
- data Reader
- newReader :: Handle -> IO Reader
- newReaderWith :: IO ByteString -> IO Reader
- data Writer
- newWriter :: Handle -> Writer
- newWriterWith :: (ByteString -> IO ()) -> Writer
- newPipe :: IO (Reader, Writer)
- data Duplex = Duplex {
- duplexWriter :: !Writer
- duplexReader :: !Reader
- newDuplex :: Handle -> IO Duplex
- newDuplexWith :: IO ByteString -> (ByteString -> IO ()) -> IO Duplex
- class CanGet r where
- read :: (CanGet r, Binary a) => r -> IO a
- class CanPut w where
- write :: (CanPut w, Binary a) => w -> a -> IO ()
Readers
data ReaderError Source #
An error that can occur during reading
Since: 0.0.1
ReaderGetError | Error from the |
|
Instances
Show ReaderError Source # | |
Defined in Data.Binary.IO showsPrec :: Int -> ReaderError -> ShowS # show :: ReaderError -> String # showList :: [ReaderError] -> ShowS # | |
Exception ReaderError Source # | |
Defined in Data.Binary.IO |
Since: 0.0.1
Create a new reader.
Reading using the Reader
may throw ReaderError
.
The internal position of the Reader
is not advanced when it throws an exception during reading.
This has the consequence that if you're trying to read with the same faulty Get
operation multiple times, you will always receive an exception.
Other threads reading from the Handle
will interfere with read operations of the Reader
.
However, the Reader
itself is thread-safe and can be utilized concurrently.
Once the Handle
reaches EOF, it will be closed.
The given Handle
will be swiched to binary mode via hSetBinaryMode
.
Since: 0.0.1
:: IO ByteString | Chunk producer |
-> IO Reader |
Writers
Since: 0.0.1
:: (ByteString -> IO ()) | Chunk handler |
-> Writer |
Create a writer using a function that handles the output chunks.
Since: 0.1.1
Pipe
Duplex
Duplex | |
|
newDuplexWith :: IO ByteString -> (ByteString -> IO ()) -> IO Duplex Source #
Combines newReaderWith
and newWriterWith
.
Since: 0.1.1
Classes
r
can execute Get
operations
Since: 0.0.1
w
can execute Put
operations
Since: 0.0.1