-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Read and write values of types that implement Binary
--
-- Read and write values of types that implement Binary
--
-- See module Data.Binary.IO.
@package binary-io
@version 0.3.0
-- | Read and write values of types that implement Binary from and
-- to Handles
module Data.Binary.IO
-- | An error that can occur during reading
data ReaderError
-- | Error from the Get operation
ReaderGetError :: !ByteString -> !ByteOffset -> !ByteString -> !String -> ReaderError
-- | Unconsumed part of the byte stream
[readerErrorRemaining] :: ReaderError -> !ByteString
-- | Error location represented as an offset into the input
[readerErrorOffset] :: ReaderError -> !ByteOffset
-- | Input to the Get operation
[readerErrorInput] :: ReaderError -> !ByteString
-- | Error message
[readerErrorMessage] :: ReaderError -> !String
data Reader
-- | 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.
newReader :: Handle -> IO Reader
-- | This function works very similar to newReader except no
-- Handle is involved. The chunk producers indicates the end of
-- the stream by returning an empty ByteString.
newReaderWith :: IO ByteString -> IO Reader
data Writer
-- | Create a writer.
--
-- Other threads writing to the same Handle do not interfere with
-- the resulting Writer. The Writer may be used
-- concurrently.
newWriter :: Handle -> Writer
-- | Create a writer using a function that handles the output chunks.
newWriterWith :: (ByteString -> IO ()) -> Writer
-- | Create a connected pair of Reader and Writer.
newPipe :: IO (Reader, Writer)
-- | Pair of Reader and Writer
data Duplex
Duplex :: !Writer -> !Reader -> Duplex
[duplexWriter] :: Duplex -> !Writer
[duplexReader] :: Duplex -> !Reader
-- | Create a new duplex. The Duplex inherits all the properties of
-- Reader and Writer when created with newReader and
-- newWriter.
newDuplex :: Handle -> IO Duplex
-- | Combines newReaderWith and newWriterWith.
newDuplexWith :: IO ByteString -> (ByteString -> IO ()) -> IO Duplex
-- | r can execute Get operations
class CanGet r
runGet :: CanGet r => r -> Get a -> IO a
-- | Read something from r.
read :: (CanGet r, Binary a) => r -> IO a
-- | Check if there is no more input to consume. This function may block.
-- All properties of runGet apply to this function as well.
isEmpty :: CanGet r => r -> IO Bool
-- | w can execute Put operations
class CanPut w
runPut :: CanPut w => w -> Put -> IO ()
-- | Write something to w.
write :: (CanPut w, Binary a) => w -> a -> IO ()
instance GHC.Exception.Type.Exception Data.Binary.IO.ReaderError
instance GHC.Show.Show Data.Binary.IO.ReaderError
instance Data.Binary.IO.CanPut GHC.IO.Handle.Types.Handle
instance Data.Binary.IO.CanPut Data.Binary.IO.Writer
instance Data.Binary.IO.CanPut Data.Binary.IO.Duplex
instance Data.Binary.IO.CanGet Data.Binary.IO.Reader
instance Data.Binary.IO.CanGet Data.Binary.IO.Duplex