-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Read and write values of types that implement Binary from and to Handles
--
-- Read and write values of types that implement Binary from and to
-- Handles
--
-- See module Data.Binary.IO.
@package binary-io
@version 0.0.1
-- | 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. The same is true
-- for follow-up actions when using readWith.
--
-- 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
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
-- | Pair of Reader and Writer
data Duplex
-- | Create a new duplex. The Duplex inherits all the properties of
-- Reader and Writer when created with newReader and
-- newWriter.
newDuplex :: Handle -> IO Duplex
-- | r can execute Get operations
class CanGet r
runGet :: CanGet r => r -> Get a -> (a -> IO b) -> IO b
-- | Read something from r.
read :: (CanGet r, Binary a) => r -> IO a
-- | Read something from r and perform an IO action with
-- it.
--
-- If the given action throws an exception, the read is not considered
-- successful and will not advance the underlying read source.
--
-- Keep in mind, long running actions on a will block other
-- threads when they try to read the from the same source r.
readWith :: (CanGet r, Binary a) => r -> (a -> IO b) -> IO b
-- | 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