direct-binary-files-1.0: Serialization and deserialization monads for streams and ByteStrings.

Safe HaskellSafe-Inferred

BinaryFiles

Documentation

class HasEndianness hasEndianness whereSource

Methods

considerEndianness :: hasEndianness -> EndiannessSource

type Serialization a = forall context. ContextualSerialization context aSource

type Deserialization a = forall context. ContextualDeserialization context aSource

class MonadSerial m whereSource

Methods

getContext :: forall context. Monad (m context) => m context contextSource

withContext :: forall context context' a. (Monad (m context), Monad (m context')) => context' -> m context' a -> m context aSource

getTags :: forall context. Monad (m context) => m context [(Int, String)]Source

withTag :: forall context a. Monad (m context) => String -> m context a -> m context aSource

withWindow :: forall context a. Monad (m context) => SerialOrigin -> Int -> Int -> m context a -> m context aSource

throw :: forall context failure a. (Monad (m context), SerializationFailure failure) => failure -> m context aSource

catch :: forall context failure a. (Monad (m context), SerializationFailure failure) => m context a -> (Int -> [(Int, String)] -> failure -> m context a) -> m context aSource

seek :: SerialOrigin -> Int -> m context ()Source

tell :: m context IntSource

isEOF :: m context BoolSource

Instances

MonadSerial ContextualDeserialization 
MonadSerial ContextualSerialization 
MonadSerial (BackendSpecificDeserialization FilePath) 
MonadSerial (BackendSpecificDeserialization ByteString) 
MonadSerial (BackendSpecificSerialization FilePath) 
MonadSerial (BackendSpecificSerialization ByteString) 

read :: MonadSerialReader m => Int -> m context ByteStringSource

write :: MonadSerialWriter m => ByteString -> m context ()Source

serializeWord :: (Bits word, Integral word, Num word, HasEndianness context) => word -> ContextualSerialization context ()Source

deserializeWord :: forall word context. (Bits word, Integral word, Num word, HasEndianness context) => ContextualDeserialization context wordSource