Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- class PrimMonad m => BinaryGetTarget z m where
- getTarget :: BinaryGetTarget z m => Get a -> z -> m (Either GetError a, ByteCount)
- class BinaryGetTarget z m => BinaryPutTarget z m where
- putTargetUnsafe :: Put -> ByteCount -> m z
- putTarget :: BinaryPutTarget z m => Put -> m z
- class BinaryGetTarget z m => MutBinaryPutTarget z m where
- mutPutTargetOffsetUnsafe :: ByteCount -> Put -> ByteCount -> z -> m ByteCount
- mutPutTargetOffset :: MutBinaryPutTarget z m => ByteCount -> Put -> z -> m ByteCount
- mutPutTarget :: MutBinaryPutTarget z m => Put -> z -> m ByteCount
- getEnd :: Get a -> Get a
- decode :: (Binary a, BinaryGetTarget z m) => z -> m (Either GetError a, ByteCount)
- decodeInc :: (Binary a, BinaryGetTarget z m) => Maybe ByteCount -> GetIncCb z m -> m (Either GetError a, ByteCount, ByteCount)
- decodeEnd :: (Binary a, BinaryGetTarget z m) => z -> m (Either GetError a, ByteCount)
- decodeFile :: Binary a => FilePath -> IO (Either GetError a, ByteCount)
- decodeFileEnd :: Binary a => FilePath -> IO (Either GetError a, ByteCount)
- encode :: (Binary a, BinaryPutTarget z m) => a -> m z
- encodeFile :: Binary a => a -> FilePath -> IO ()
- mutEncode :: (Binary a, MutBinaryPutTarget z m) => a -> z -> m ByteCount
Documentation
class PrimMonad m => BinaryGetTarget z m where Source #
Abstracts over the sources we can read from.
getTargetOffset :: ByteCount -> Get a -> z -> m (Either GetError a, ByteCount) Source #
Get a value from the source given a starting offset, returning a result and final offset. On error, the offset will indicate where in the source the error occurred.
getTargetInc :: Maybe ByteCount -> Get a -> GetIncCb z m -> m (Either GetError a, ByteCount, ByteCount) Source #
Get a value incrementally from sources yielded by the given callback, returning a result, final offset in the whole stream, and final offset in the current chunk. Takes an optional maximum capacity.
Instances
BinaryGetTarget ByteString IO Source # | |
Defined in Dahdit.Iface | |
PrimMonad m => BinaryGetTarget ShortByteString m Source # | |
Defined in Dahdit.Iface | |
PrimMonad m => BinaryGetTarget ByteArray m Source # | |
BinaryGetTarget Text IO Source # | |
BinaryGetTarget String IO Source # | |
MonadPrim s m => BinaryGetTarget (MutableByteArray s) m Source # | |
Defined in Dahdit.Iface | |
BinaryGetTarget (Vector Word8) IO Source # | |
BinaryGetTarget (IOVector Word8) IO Source # | |
getTarget :: BinaryGetTarget z m => Get a -> z -> m (Either GetError a, ByteCount) Source #
Get a value from the source, returning a result and final offset.
class BinaryGetTarget z m => BinaryPutTarget z m where Source #
Abstracts over the immutable sinks we can render to.
putTargetUnsafe :: Put -> ByteCount -> m z Source #
Instances
BinaryPutTarget ByteString IO Source # | |
Defined in Dahdit.Iface putTargetUnsafe :: Put -> ByteCount -> IO ByteString Source # | |
PrimMonad m => BinaryPutTarget ShortByteString m Source # | |
Defined in Dahdit.Iface putTargetUnsafe :: Put -> ByteCount -> m ShortByteString Source # | |
PrimMonad m => BinaryPutTarget ByteArray m Source # | |
Defined in Dahdit.Iface | |
BinaryPutTarget Text IO Source # | |
Defined in Dahdit.Iface | |
BinaryPutTarget String IO Source # | |
Defined in Dahdit.Iface | |
BinaryPutTarget (Vector Word8) IO Source # | |
Defined in Dahdit.Iface |
putTarget :: BinaryPutTarget z m => Put -> m z Source #
Put an action to the sink with calculated capacity.
class BinaryGetTarget z m => MutBinaryPutTarget z m where Source #
Instances
MonadPrim s m => MutBinaryPutTarget (MutableByteArray s) m Source # | |
Defined in Dahdit.Iface mutPutTargetOffsetUnsafe :: ByteCount -> Put -> ByteCount -> MutableByteArray s -> m ByteCount Source # | |
MutBinaryPutTarget (IOVector Word8) IO Source # | |
mutPutTargetOffset :: MutBinaryPutTarget z m => ByteCount -> Put -> z -> m ByteCount Source #
mutPutTarget :: MutBinaryPutTarget z m => Put -> z -> m ByteCount Source #
decode :: (Binary a, BinaryGetTarget z m) => z -> m (Either GetError a, ByteCount) Source #
Decode a value from a source returning a result and consumed byte count.
decodeInc :: (Binary a, BinaryGetTarget z m) => Maybe ByteCount -> GetIncCb z m -> m (Either GetError a, ByteCount, ByteCount) Source #
Decode a value incrementally from sources yielded by a callback.
decodeEnd :: (Binary a, BinaryGetTarget z m) => z -> m (Either GetError a, ByteCount) Source #
decode
but expect the end of input.
decodeFile :: Binary a => FilePath -> IO (Either GetError a, ByteCount) Source #
Decode a value from a file.
decodeFileEnd :: Binary a => FilePath -> IO (Either GetError a, ByteCount) Source #
decodeFile
but expect the end of file.
encode :: (Binary a, BinaryPutTarget z m) => a -> m z Source #
Encode a value to a sink.