Data.Deserializer

data-serializer-0.3: Common API for serialization libraries

Safe Haskell | None
Language | Haskell2010

Data.Deserializer

Contents

- Deserialization monad
  - Binary word parsing
  - Parsing combinators
  - Endian deserializers
- Deserializable types

Description

Deserialization monad and deserializable types.

Synopsis

- class (Monad μ, Parsing μ) => Deserializer μ where
- newtype BinaryDeserializer α = BinaryDeserializer {
  - binaryDeserializer :: Get α
  }
- newtype CerealDeserializer α = CerealDeserializer {
  - cerealDeserializer :: Get α
  }
- word16H :: Deserializer μ => μ Word16
- word32H :: Deserializer μ => μ Word32
- word64H :: Deserializer μ => μ Word64
- word :: Deserializer μ => μ Word
- wordL :: Deserializer μ => μ Word
- wordB :: Deserializer μ => μ Word
- wordH :: Deserializer μ => μ Word
- int8 :: Deserializer μ => μ Int8
- int16 :: Deserializer μ => μ Int16
- int16L :: Deserializer μ => μ Int16
- int16B :: Deserializer μ => μ Int16
- int16H :: Deserializer μ => μ Int16
- int32 :: Deserializer μ => μ Int32
- int32L :: Deserializer μ => μ Int32
- int32B :: Deserializer μ => μ Int32
- int32H :: Deserializer μ => μ Int32
- int64 :: Deserializer μ => μ Int64
- int64L :: Deserializer μ => μ Int64
- int64B :: Deserializer μ => μ Int64
- int64H :: Deserializer μ => μ Int64
- int :: Deserializer μ => μ Int
- intL :: Deserializer μ => μ Int
- intB :: Deserializer μ => μ Int
- intH :: Deserializer μ => μ Int
- module Text.Parser.Combinators
- label :: Parsing μ => String -> μ α -> μ α
- module Text.Parser.LookAhead
- newtype LittleEndianDeserializer μ α = LittleEndianDeserializer {
  - deserializeL :: μ α
  }
- newtype BigEndianDeserializer μ α = BigEndianDeserializer {
  - deserializeB :: μ α
  }
- deserializeIn :: Deserializer μ => Endian -> (forall μ'. Deserializer μ' => μ' α) -> μ α
- deserializeH :: Deserializer μ => (forall μ'. Deserializer μ' => μ' α) -> μ α
- class Deserializable α where
- getIn :: (Deserializer μ, Deserializable α) => Endian -> μ α
- getL :: (Deserializer μ, Deserializable α) => μ α
- getB :: (Deserializer μ, Deserializable α) => μ α
- getH :: (Deserializer μ, Deserializable α) => μ α
- class RestDeserializable α where

# Deserialization monad

class (Monad μ, Parsing μ) => Deserializer μ where #

Deserialization monad.

Minimal complete definition

ensure, take, chunk, isolate

Methods

endian :: Proxy μ -> Endian #

Default byte order of the deserializer.

word8 :: μ Word8 #

Deserialze a byte.

word16 :: μ Word16 #

Deserialize an unsigned 16-bit integer in default byte order.

word32 :: μ Word32 #

Deserialize an unsigned 32-bit integer in default byte order.

word64 :: μ Word64 #

Deserialize an unsigned 64-bit integer in default byte order.

word16L :: μ Word16 #

Deserialize an unsigned 16-bit integer in little endian.

word16B :: μ Word16 #

Deserialize an unsigned 16-bit integer in big endian.

word32L :: μ Word32 #

Deserialize an unsigned 32-bit integer in little endian.

word32B :: μ Word32 #

Deserialize an unsigned 32-bit integer in big endian.

word64L :: μ Word64 #

Deserialize an unsigned 64-bit integer in little endian.

word64B :: μ Word64 #

Deserialize an unsigned 64-bit integer in big endian.

satisfy :: (Word8 -> Bool) -> μ Word8 #

`satisfy` p deserializes a byte that satisfies the predicate p, failing otherwise.

byte :: Word8 -> μ Word8 #

Deserialize the specified byte value, failing on any other input.

notByte :: Word8 -> μ Word8 #

`notByte` c deserializes any byte that is not equal to c, failing if c is encountered.

bytes :: ByteString -> μ ByteString #

`bytes` bs deserializes a sequence of bytes given by bs, failing on any other input.

skip :: Int -> μ () #

Skip exactly the given number of bytes.

ensure :: Int -> μ ByteString #

`ensure` n checks that the input has at least n more bytes and returns a portion of the input of length greater or equal to n (without consuming it).

ensure_ :: Int -> μ () #

`ensure_` n fails if the input has less than n more bytes.

take :: Int -> μ ByteString #

Consume exactly the given number of bytes.

chunk :: μ ByteString #

Consume a portion of the input (the size of the returned `ByteString` is implementation dependent). Empty result means that the `eof` is reached.

isolate :: Int -> μ α -> μ α #

`isolate` n d feeds the next n bytes to the deserializer d. If d consumes less or more that n bytes, `isolate` will fail.

Instances

Deserializer CerealDeserializer # |
Methods endian :: Proxy (* -> *) CerealDeserializer -> Endian # word8 :: CerealDeserializer Word8 # word16 :: CerealDeserializer Word16 # word32 :: CerealDeserializer Word32 # word64 :: CerealDeserializer Word64 # word16L :: CerealDeserializer Word16 # word16B :: CerealDeserializer Word16 # word32L :: CerealDeserializer Word32 # word32B :: CerealDeserializer Word32 # word64L :: CerealDeserializer Word64 # word64B :: CerealDeserializer Word64 # satisfy :: (Word8 -> Bool) -> CerealDeserializer Word8 # byte :: Word8 -> CerealDeserializer Word8 # notByte :: Word8 -> CerealDeserializer Word8 # bytes :: ByteString -> CerealDeserializer ByteString # skip :: Int -> CerealDeserializer () # ensure :: Int -> CerealDeserializer ByteString # ensure_ :: Int -> CerealDeserializer () # take :: Int -> CerealDeserializer ByteString # chunk :: CerealDeserializer ByteString # isolate :: Int -> CerealDeserializer α -> CerealDeserializer α #
Deserializer BinaryDeserializer # |
Methods endian :: Proxy (* -> *) BinaryDeserializer -> Endian # word8 :: BinaryDeserializer Word8 # word16 :: BinaryDeserializer Word16 # word32 :: BinaryDeserializer Word32 # word64 :: BinaryDeserializer Word64 # word16L :: BinaryDeserializer Word16 # word16B :: BinaryDeserializer Word16 # word32L :: BinaryDeserializer Word32 # word32B :: BinaryDeserializer Word32 # word64L :: BinaryDeserializer Word64 # word64B :: BinaryDeserializer Word64 # satisfy :: (Word8 -> Bool) -> BinaryDeserializer Word8 # byte :: Word8 -> BinaryDeserializer Word8 # notByte :: Word8 -> BinaryDeserializer Word8 # bytes :: ByteString -> BinaryDeserializer ByteString # skip :: Int -> BinaryDeserializer () # ensure :: Int -> BinaryDeserializer ByteString # ensure_ :: Int -> BinaryDeserializer () # take :: Int -> BinaryDeserializer ByteString # chunk :: BinaryDeserializer ByteString # isolate :: Int -> BinaryDeserializer α -> BinaryDeserializer α #
Deserializer μ => Deserializer (BigEndianDeserializer μ) # |
Methods endian :: Proxy (* -> *) (BigEndianDeserializer μ) -> Endian # word8 :: BigEndianDeserializer μ Word8 # word16 :: BigEndianDeserializer μ Word16 # word32 :: BigEndianDeserializer μ Word32 # word64 :: BigEndianDeserializer μ Word64 # word16L :: BigEndianDeserializer μ Word16 # word16B :: BigEndianDeserializer μ Word16 # word32L :: BigEndianDeserializer μ Word32 # word32B :: BigEndianDeserializer μ Word32 # word64L :: BigEndianDeserializer μ Word64 # word64B :: BigEndianDeserializer μ Word64 # satisfy :: (Word8 -> Bool) -> BigEndianDeserializer μ Word8 # byte :: Word8 -> BigEndianDeserializer μ Word8 # notByte :: Word8 -> BigEndianDeserializer μ Word8 # bytes :: ByteString -> BigEndianDeserializer μ ByteString # skip :: Int -> BigEndianDeserializer μ () # ensure :: Int -> BigEndianDeserializer μ ByteString # ensure_ :: Int -> BigEndianDeserializer μ () # take :: Int -> BigEndianDeserializer μ ByteString # chunk :: BigEndianDeserializer μ ByteString # isolate :: Int -> BigEndianDeserializer μ α -> BigEndianDeserializer μ α #
Deserializer μ => Deserializer (LittleEndianDeserializer μ) # |
Methods endian :: Proxy (* -> *) (LittleEndianDeserializer μ) -> Endian # word8 :: LittleEndianDeserializer μ Word8 # word16 :: LittleEndianDeserializer μ Word16 # word32 :: LittleEndianDeserializer μ Word32 # word64 :: LittleEndianDeserializer μ Word64 # word16L :: LittleEndianDeserializer μ Word16 # word16B :: LittleEndianDeserializer μ Word16 # word32L :: LittleEndianDeserializer μ Word32 # word32B :: LittleEndianDeserializer μ Word32 # word64L :: LittleEndianDeserializer μ Word64 # word64B :: LittleEndianDeserializer μ Word64 # satisfy :: (Word8 -> Bool) -> LittleEndianDeserializer μ Word8 # byte :: Word8 -> LittleEndianDeserializer μ Word8 # notByte :: Word8 -> LittleEndianDeserializer μ Word8 # bytes :: ByteString -> LittleEndianDeserializer μ ByteString # skip :: Int -> LittleEndianDeserializer μ () # ensure :: Int -> LittleEndianDeserializer μ ByteString # ensure_ :: Int -> LittleEndianDeserializer μ () # take :: Int -> LittleEndianDeserializer μ ByteString # chunk :: LittleEndianDeserializer μ ByteString # isolate :: Int -> LittleEndianDeserializer μ α -> LittleEndianDeserializer μ α #

newtype BinaryDeserializer α #

A wrapper around the `Get` monad (to avoid orphan instances).

Constructors

BinaryDeserializer |
Fields binaryDeserializer :: Get α

Instances

Monad BinaryDeserializer # |
Methods (>>=) :: BinaryDeserializer a -> (a -> BinaryDeserializer b) -> BinaryDeserializer b # (>>) :: BinaryDeserializer a -> BinaryDeserializer b -> BinaryDeserializer b # return :: a -> BinaryDeserializer a # fail :: String -> BinaryDeserializer a #
Functor BinaryDeserializer # |
Methods fmap :: (a -> b) -> BinaryDeserializer a -> BinaryDeserializer b # (<$) :: a -> BinaryDeserializer b -> BinaryDeserializer a #
Applicative BinaryDeserializer # |
Methods pure :: a -> BinaryDeserializer a # (<*>) :: BinaryDeserializer (a -> b) -> BinaryDeserializer a -> BinaryDeserializer b # (*>) :: BinaryDeserializer a -> BinaryDeserializer b -> BinaryDeserializer b # (<*) :: BinaryDeserializer a -> BinaryDeserializer b -> BinaryDeserializer a #
Alternative BinaryDeserializer # |
Methods empty :: BinaryDeserializer a # (<|>) :: BinaryDeserializer a -> BinaryDeserializer a -> BinaryDeserializer a # some :: BinaryDeserializer a -> BinaryDeserializer [a] # many :: BinaryDeserializer a -> BinaryDeserializer [a] #
LookAheadParsing BinaryDeserializer # |
Methods lookAhead :: BinaryDeserializer a -> BinaryDeserializer a #
Parsing BinaryDeserializer # |
Methods try :: BinaryDeserializer a -> BinaryDeserializer a # (<?>) :: BinaryDeserializer a -> String -> BinaryDeserializer a # skipMany :: BinaryDeserializer a -> BinaryDeserializer () # skipSome :: BinaryDeserializer a -> BinaryDeserializer () # unexpected :: String -> BinaryDeserializer a # eof :: BinaryDeserializer () # notFollowedBy :: Show a => BinaryDeserializer a -> BinaryDeserializer () #
Deserializer BinaryDeserializer # |
Methods endian :: Proxy (* -> *) BinaryDeserializer -> Endian # word8 :: BinaryDeserializer Word8 # word16 :: BinaryDeserializer Word16 # word32 :: BinaryDeserializer Word32 # word64 :: BinaryDeserializer Word64 # word16L :: BinaryDeserializer Word16 # word16B :: BinaryDeserializer Word16 # word32L :: BinaryDeserializer Word32 # word32B :: BinaryDeserializer Word32 # word64L :: BinaryDeserializer Word64 # word64B :: BinaryDeserializer Word64 # satisfy :: (Word8 -> Bool) -> BinaryDeserializer Word8 # byte :: Word8 -> BinaryDeserializer Word8 # notByte :: Word8 -> BinaryDeserializer Word8 # bytes :: ByteString -> BinaryDeserializer ByteString # skip :: Int -> BinaryDeserializer () # ensure :: Int -> BinaryDeserializer ByteString # ensure_ :: Int -> BinaryDeserializer () # take :: Int -> BinaryDeserializer ByteString # chunk :: BinaryDeserializer ByteString # isolate :: Int -> BinaryDeserializer α -> BinaryDeserializer α #
Generic (BinaryDeserializer α) # |
Associated Types type Rep (BinaryDeserializer α) :: * -> * # Methods from :: BinaryDeserializer α -> Rep (BinaryDeserializer α) x # to :: Rep (BinaryDeserializer α) x -> BinaryDeserializer α #
type Rep (BinaryDeserializer α) # |
type Rep (BinaryDeserializer α) = D1 (MetaData "BinaryDeserializer" "Data.Deserializer" "data-serializer-0.3-9WFccAilONr3Wb9VwWeLkx" True) (C1 (MetaCons "BinaryDeserializer" PrefixI True) (S1 (MetaSel (Just Symbol "binaryDeserializer") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Get α))))

newtype CerealDeserializer α #

A wrapper around the `Get` monad (to avoid orphan instances).

Constructors

CerealDeserializer |
Fields cerealDeserializer :: Get α

Instances

Monad CerealDeserializer # |
Methods (>>=) :: CerealDeserializer a -> (a -> CerealDeserializer b) -> CerealDeserializer b # (>>) :: CerealDeserializer a -> CerealDeserializer b -> CerealDeserializer b # return :: a -> CerealDeserializer a # fail :: String -> CerealDeserializer a #
Functor CerealDeserializer # |
Methods fmap :: (a -> b) -> CerealDeserializer a -> CerealDeserializer b # (<$) :: a -> CerealDeserializer b -> CerealDeserializer a #
Applicative CerealDeserializer # |
Methods pure :: a -> CerealDeserializer a # (<*>) :: CerealDeserializer (a -> b) -> CerealDeserializer a -> CerealDeserializer b # (*>) :: CerealDeserializer a -> CerealDeserializer b -> CerealDeserializer b # (<*) :: CerealDeserializer a -> CerealDeserializer b -> CerealDeserializer a #
Alternative CerealDeserializer # |
Methods empty :: CerealDeserializer a # (<|>) :: CerealDeserializer a -> CerealDeserializer a -> CerealDeserializer a # some :: CerealDeserializer a -> CerealDeserializer [a] # many :: CerealDeserializer a -> CerealDeserializer [a] #
LookAheadParsing CerealDeserializer # |
Methods lookAhead :: CerealDeserializer a -> CerealDeserializer a #
Parsing CerealDeserializer # |
Methods try :: CerealDeserializer a -> CerealDeserializer a # (<?>) :: CerealDeserializer a -> String -> CerealDeserializer a # skipMany :: CerealDeserializer a -> CerealDeserializer () # skipSome :: CerealDeserializer a -> CerealDeserializer () # unexpected :: String -> CerealDeserializer a # eof :: CerealDeserializer () # notFollowedBy :: Show a => CerealDeserializer a -> CerealDeserializer () #
Deserializer CerealDeserializer # |
Methods endian :: Proxy (* -> *) CerealDeserializer -> Endian # word8 :: CerealDeserializer Word8 # word16 :: CerealDeserializer Word16 # word32 :: CerealDeserializer Word32 # word64 :: CerealDeserializer Word64 # word16L :: CerealDeserializer Word16 # word16B :: CerealDeserializer Word16 # word32L :: CerealDeserializer Word32 # word32B :: CerealDeserializer Word32 # word64L :: CerealDeserializer Word64 # word64B :: CerealDeserializer Word64 # satisfy :: (Word8 -> Bool) -> CerealDeserializer Word8 # byte :: Word8 -> CerealDeserializer Word8 # notByte :: Word8 -> CerealDeserializer Word8 # bytes :: ByteString -> CerealDeserializer ByteString # skip :: Int -> CerealDeserializer () # ensure :: Int -> CerealDeserializer ByteString # ensure_ :: Int -> CerealDeserializer () # take :: Int -> CerealDeserializer ByteString # chunk :: CerealDeserializer ByteString # isolate :: Int -> CerealDeserializer α -> CerealDeserializer α #
Generic (CerealDeserializer α) # |
Associated Types type Rep (CerealDeserializer α) :: * -> * # Methods from :: CerealDeserializer α -> Rep (CerealDeserializer α) x # to :: Rep (CerealDeserializer α) x -> CerealDeserializer α #
type Rep (CerealDeserializer α) # |
type Rep (CerealDeserializer α) = D1 (MetaData "CerealDeserializer" "Data.Deserializer" "data-serializer-0.3-9WFccAilONr3Wb9VwWeLkx" True) (C1 (MetaCons "CerealDeserializer" PrefixI True) (S1 (MetaSel (Just Symbol "cerealDeserializer") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (Get α))))

## Binary word parsing

word16H :: Deserializer μ => μ Word16 #

Deserialize an unsigned 16-bit integer in host byte order.

word32H :: Deserializer μ => μ Word32 #

Deserialize an unsigned 32-bit integer in host byte order.

word64H :: Deserializer μ => μ Word64 #

Deserialize an unsigned 64-bit integer in host byte order.

word :: Deserializer μ => μ Word #

Deserialize an unsigned native-sized integer in serializer default byte order.

wordL :: Deserializer μ => μ Word #

Deserialize an unsigned native-sized integer in little endian.

wordB :: Deserializer μ => μ Word #

Deserialize an unsigned native-sized integer in big endian.

wordH :: Deserializer μ => μ Word #

Deserialize an unsigned native-sized integer in host byte order.

int8 :: Deserializer μ => μ Int8 #

Deserialize a signed 8-bit integer.

int16 :: Deserializer μ => μ Int16 #

Deserialize a signed 16-bit integer in serializer default byte order.

int16L :: Deserializer μ => μ Int16 #

Deserialize a signed 16-bit integer in little endian.

int16B :: Deserializer μ => μ Int16 #

Deserialize a signed 16-bit integer in big endian.

int16H :: Deserializer μ => μ Int16 #

Deserialize a signed 16-bit integer in host byte order.

int32 :: Deserializer μ => μ Int32 #

Deserialize a signed 32-bit integer in serializer default byte order.

int32L :: Deserializer μ => μ Int32 #

Deserialize a signed 32-bit integer in little endian.

int32B :: Deserializer μ => μ Int32 #

Deserialize a signed 32-bit integer in big endian.

int32H :: Deserializer μ => μ Int32 #

Deserialize a signed 32-bit integer in host byte order.

int64 :: Deserializer μ => μ Int64 #

Deserialize a signed 64-bit integer in serializer default byte order.

int64L :: Deserializer μ => μ Int64 #

Deserialize a signed 64-bit integer in little endian.

int64B :: Deserializer μ => μ Int64 #

Deserialize a signed 64-bit integer in big endian.

int64H :: Deserializer μ => μ Int64 #

Deserialize a signed 64-bit integer in host byte order.

int :: Deserializer μ => μ Int #

Deserialize a signed native-sized integer in serializer default byte order.

intL :: Deserializer μ => μ Int #

Deserialize a signed native-sized integer in little endian.

intB :: Deserializer μ => μ Int #

Deserialize a signed native-sized integer in big endian.

intH :: Deserializer μ => μ Int #

Deserialize a signed native-sized integer in host byte order.

## Parsing combinators

module Text.Parser.Combinators

label :: Parsing μ => String -> μ α -> μ α #

A shorthand for `flip` (`<?>`).

module Text.Parser.LookAhead

## Endian deserializers

newtype LittleEndianDeserializer μ α #

Deserializer wrapper with little endian default byte order.

Constructors

LittleEndianDeserializer |
Fields deserializeL :: μ α

Instances

Monad μ => Monad (LittleEndianDeserializer μ) # |
Methods (>>=) :: LittleEndianDeserializer μ a -> (a -> LittleEndianDeserializer μ b) -> LittleEndianDeserializer μ b # (>>) :: LittleEndianDeserializer μ a -> LittleEndianDeserializer μ b -> LittleEndianDeserializer μ b # return :: a -> LittleEndianDeserializer μ a # fail :: String -> LittleEndianDeserializer μ a #
Functor μ => Functor (LittleEndianDeserializer μ) # |
Methods fmap :: (a -> b) -> LittleEndianDeserializer μ a -> LittleEndianDeserializer μ b # (<$) :: a -> LittleEndianDeserializer μ b -> LittleEndianDeserializer μ a #
Applicative μ => Applicative (LittleEndianDeserializer μ) # |
Methods pure :: a -> LittleEndianDeserializer μ a # (<*>) :: LittleEndianDeserializer μ (a -> b) -> LittleEndianDeserializer μ a -> LittleEndianDeserializer μ b # (*>) :: LittleEndianDeserializer μ a -> LittleEndianDeserializer μ b -> LittleEndianDeserializer μ b # (<*) :: LittleEndianDeserializer μ a -> LittleEndianDeserializer μ b -> LittleEndianDeserializer μ a #
Alternative μ => Alternative (LittleEndianDeserializer μ) # |
Methods empty :: LittleEndianDeserializer μ a # (<|>) :: LittleEndianDeserializer μ a -> LittleEndianDeserializer μ a -> LittleEndianDeserializer μ a # some :: LittleEndianDeserializer μ a -> LittleEndianDeserializer μ [a] # many :: LittleEndianDeserializer μ a -> LittleEndianDeserializer μ [a] #
LookAheadParsing μ => LookAheadParsing (LittleEndianDeserializer μ) # |
Methods lookAhead :: LittleEndianDeserializer μ a -> LittleEndianDeserializer μ a #
Parsing μ => Parsing (LittleEndianDeserializer μ) # |
Methods try :: LittleEndianDeserializer μ a -> LittleEndianDeserializer μ a # (<?>) :: LittleEndianDeserializer μ a -> String -> LittleEndianDeserializer μ a # skipMany :: LittleEndianDeserializer μ a -> LittleEndianDeserializer μ () # skipSome :: LittleEndianDeserializer μ a -> LittleEndianDeserializer μ () # unexpected :: String -> LittleEndianDeserializer μ a # eof :: LittleEndianDeserializer μ () # notFollowedBy :: Show a => LittleEndianDeserializer μ a -> LittleEndianDeserializer μ () #
Deserializer μ => Deserializer (LittleEndianDeserializer μ) # |
Methods endian :: Proxy (* -> *) (LittleEndianDeserializer μ) -> Endian # word8 :: LittleEndianDeserializer μ Word8 # word16 :: LittleEndianDeserializer μ Word16 # word32 :: LittleEndianDeserializer μ Word32 # word64 :: LittleEndianDeserializer μ Word64 # word16L :: LittleEndianDeserializer μ Word16 # word16B :: LittleEndianDeserializer μ Word16 # word32L :: LittleEndianDeserializer μ Word32 # word32B :: LittleEndianDeserializer μ Word32 # word64L :: LittleEndianDeserializer μ Word64 # word64B :: LittleEndianDeserializer μ Word64 # satisfy :: (Word8 -> Bool) -> LittleEndianDeserializer μ Word8 # byte :: Word8 -> LittleEndianDeserializer μ Word8 # notByte :: Word8 -> LittleEndianDeserializer μ Word8 # bytes :: ByteString -> LittleEndianDeserializer μ ByteString # skip :: Int -> LittleEndianDeserializer μ () # ensure :: Int -> LittleEndianDeserializer μ ByteString # ensure_ :: Int -> LittleEndianDeserializer μ () # take :: Int -> LittleEndianDeserializer μ ByteString # chunk :: LittleEndianDeserializer μ ByteString # isolate :: Int -> LittleEndianDeserializer μ α -> LittleEndianDeserializer μ α #
(Data (μ α), Typeable * α, Typeable (* -> *) μ) => Data (LittleEndianDeserializer μ α) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LittleEndianDeserializer μ α -> c (LittleEndianDeserializer μ α) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (LittleEndianDeserializer μ α) # toConstr :: LittleEndianDeserializer μ α -> Constr # dataTypeOf :: LittleEndianDeserializer μ α -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (LittleEndianDeserializer μ α)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (LittleEndianDeserializer μ α)) # gmapT :: (forall b. Data b => b -> b) -> LittleEndianDeserializer μ α -> LittleEndianDeserializer μ α # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LittleEndianDeserializer μ α -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LittleEndianDeserializer μ α -> r # gmapQ :: (forall d. Data d => d -> u) -> LittleEndianDeserializer μ α -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> LittleEndianDeserializer μ α -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LittleEndianDeserializer μ α -> m (LittleEndianDeserializer μ α) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LittleEndianDeserializer μ α -> m (LittleEndianDeserializer μ α) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LittleEndianDeserializer μ α -> m (LittleEndianDeserializer μ α) #
Generic (LittleEndianDeserializer μ α) # |
Associated Types type Rep (LittleEndianDeserializer μ α) :: * -> * # Methods from :: LittleEndianDeserializer μ α -> Rep (LittleEndianDeserializer μ α) x # to :: Rep (LittleEndianDeserializer μ α) x -> LittleEndianDeserializer μ α #
type Rep (LittleEndianDeserializer μ α) # |
type Rep (LittleEndianDeserializer μ α) = D1 (MetaData "LittleEndianDeserializer" "Data.Deserializer" "data-serializer-0.3-9WFccAilONr3Wb9VwWeLkx" True) (C1 (MetaCons "LittleEndianDeserializer" PrefixI True) (S1 (MetaSel (Just Symbol "deserializeL") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (μ α))))

newtype BigEndianDeserializer μ α #

Deserializer wrapper with big endian default byte order.

Constructors

BigEndianDeserializer |
Fields deserializeB :: μ α

Instances

Monad μ => Monad (BigEndianDeserializer μ) # |
Methods (>>=) :: BigEndianDeserializer μ a -> (a -> BigEndianDeserializer μ b) -> BigEndianDeserializer μ b # (>>) :: BigEndianDeserializer μ a -> BigEndianDeserializer μ b -> BigEndianDeserializer μ b # return :: a -> BigEndianDeserializer μ a # fail :: String -> BigEndianDeserializer μ a #
Functor μ => Functor (BigEndianDeserializer μ) # |
Methods fmap :: (a -> b) -> BigEndianDeserializer μ a -> BigEndianDeserializer μ b # (<$) :: a -> BigEndianDeserializer μ b -> BigEndianDeserializer μ a #
Applicative μ => Applicative (BigEndianDeserializer μ) # |
Methods pure :: a -> BigEndianDeserializer μ a # (<*>) :: BigEndianDeserializer μ (a -> b) -> BigEndianDeserializer μ a -> BigEndianDeserializer μ b # (*>) :: BigEndianDeserializer μ a -> BigEndianDeserializer μ b -> BigEndianDeserializer μ b # (<*) :: BigEndianDeserializer μ a -> BigEndianDeserializer μ b -> BigEndianDeserializer μ a #
Alternative μ => Alternative (BigEndianDeserializer μ) # |
Methods empty :: BigEndianDeserializer μ a # (<|>) :: BigEndianDeserializer μ a -> BigEndianDeserializer μ a -> BigEndianDeserializer μ a # some :: BigEndianDeserializer μ a -> BigEndianDeserializer μ [a] # many :: BigEndianDeserializer μ a -> BigEndianDeserializer μ [a] #
LookAheadParsing μ => LookAheadParsing (BigEndianDeserializer μ) # |
Methods lookAhead :: BigEndianDeserializer μ a -> BigEndianDeserializer μ a #
Parsing μ => Parsing (BigEndianDeserializer μ) # |
Methods try :: BigEndianDeserializer μ a -> BigEndianDeserializer μ a # (<?>) :: BigEndianDeserializer μ a -> String -> BigEndianDeserializer μ a # skipMany :: BigEndianDeserializer μ a -> BigEndianDeserializer μ () # skipSome :: BigEndianDeserializer μ a -> BigEndianDeserializer μ () # unexpected :: String -> BigEndianDeserializer μ a # eof :: BigEndianDeserializer μ () # notFollowedBy :: Show a => BigEndianDeserializer μ a -> BigEndianDeserializer μ () #
Deserializer μ => Deserializer (BigEndianDeserializer μ) # |
Methods endian :: Proxy (* -> *) (BigEndianDeserializer μ) -> Endian # word8 :: BigEndianDeserializer μ Word8 # word16 :: BigEndianDeserializer μ Word16 # word32 :: BigEndianDeserializer μ Word32 # word64 :: BigEndianDeserializer μ Word64 # word16L :: BigEndianDeserializer μ Word16 # word16B :: BigEndianDeserializer μ Word16 # word32L :: BigEndianDeserializer μ Word32 # word32B :: BigEndianDeserializer μ Word32 # word64L :: BigEndianDeserializer μ Word64 # word64B :: BigEndianDeserializer μ Word64 # satisfy :: (Word8 -> Bool) -> BigEndianDeserializer μ Word8 # byte :: Word8 -> BigEndianDeserializer μ Word8 # notByte :: Word8 -> BigEndianDeserializer μ Word8 # bytes :: ByteString -> BigEndianDeserializer μ ByteString # skip :: Int -> BigEndianDeserializer μ () # ensure :: Int -> BigEndianDeserializer μ ByteString # ensure_ :: Int -> BigEndianDeserializer μ () # take :: Int -> BigEndianDeserializer μ ByteString # chunk :: BigEndianDeserializer μ ByteString # isolate :: Int -> BigEndianDeserializer μ α -> BigEndianDeserializer μ α #
(Data (μ α), Typeable * α, Typeable (* -> *) μ) => Data (BigEndianDeserializer μ α) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BigEndianDeserializer μ α -> c (BigEndianDeserializer μ α) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (BigEndianDeserializer μ α) # toConstr :: BigEndianDeserializer μ α -> Constr # dataTypeOf :: BigEndianDeserializer μ α -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (BigEndianDeserializer μ α)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (BigEndianDeserializer μ α)) # gmapT :: (forall b. Data b => b -> b) -> BigEndianDeserializer μ α -> BigEndianDeserializer μ α # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BigEndianDeserializer μ α -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BigEndianDeserializer μ α -> r # gmapQ :: (forall d. Data d => d -> u) -> BigEndianDeserializer μ α -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> BigEndianDeserializer μ α -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> BigEndianDeserializer μ α -> m (BigEndianDeserializer μ α) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BigEndianDeserializer μ α -> m (BigEndianDeserializer μ α) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BigEndianDeserializer μ α -> m (BigEndianDeserializer μ α) #
Generic (BigEndianDeserializer μ α) # |
Associated Types type Rep (BigEndianDeserializer μ α) :: * -> * # Methods from :: BigEndianDeserializer μ α -> Rep (BigEndianDeserializer μ α) x # to :: Rep (BigEndianDeserializer μ α) x -> BigEndianDeserializer μ α #
type Rep (BigEndianDeserializer μ α) # |
type Rep (BigEndianDeserializer μ α) = D1 (MetaData "BigEndianDeserializer" "Data.Deserializer" "data-serializer-0.3-9WFccAilONr3Wb9VwWeLkx" True) (C1 (MetaCons "BigEndianDeserializer" PrefixI True) (S1 (MetaSel (Just Symbol "deserializeB") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 (μ α))))

deserializeIn :: Deserializer μ => Endian -> (forall μ'. Deserializer μ' => μ' α) -> μ α #

Force the default byte order.

deserializeH :: Deserializer μ => (forall μ'. Deserializer μ' => μ' α) -> μ α #

Force the default byte order to be the host byte order.

# Deserializable types

class Deserializable α where #

Deserializable type. `get` must not rely on `eof`.

Minimal complete definition

get

Methods

get :: Deserializer μ => μ α #

Instances

Deserializable Bool # |
Methods get :: Deserializer μ => μ Bool #
Deserializable Int # |
Methods get :: Deserializer μ => μ Int #
Deserializable Int8 # |
Methods get :: Deserializer μ => μ Int8 #
Deserializable Int16 # |
Methods get :: Deserializer μ => μ Int16 #
Deserializable Int32 # |
Methods get :: Deserializer μ => μ Int32 #
Deserializable Int64 # |
Methods get :: Deserializer μ => μ Int64 #
Deserializable Word # |
Methods get :: Deserializer μ => μ Word #
Deserializable Word8 # |
Methods get :: Deserializer μ => μ Word8 #
Deserializable Word16 # |
Methods get :: Deserializer μ => μ Word16 #
Deserializable Word32 # |
Methods get :: Deserializer μ => μ Word32 #
Deserializable Word64 # |
Methods get :: Deserializer μ => μ Word64 #
Deserializable ByteString # |
Methods get :: Deserializer μ => μ ByteString #
Deserializable ShortByteString # |
Methods get :: Deserializer μ => μ ShortByteString #
Deserializable α => Deserializable (Maybe α) # |
Methods get :: Deserializer μ => μ (Maybe α) #
(Deserializable α, Deserializable β) => Deserializable (Either α β) # |
Methods get :: Deserializer μ => μ (Either α β) #
(Deserializable α, Deserializable β) => Deserializable (α, β) # |
Methods get :: Deserializer μ => μ (α, β) #

getIn :: (Deserializer μ, Deserializable α) => Endian -> μ α #

Deserialize a value using the provided default byte order.

getL :: (Deserializer μ, Deserializable α) => μ α #

Deserialize a value using little endian as the default byte order.

getB :: (Deserializer μ, Deserializable α) => μ α #

Deserialize a value using big endian as the default byte order.

getH :: (Deserializer μ, Deserializable α) => μ α #

Deserialize a value using host byte order as the default byte order.

class RestDeserializable α where #

Deserializable type. `getRest` must consume all the remaining input or fail.

Minimal complete definition

getRest

Methods

getRest :: Deserializer μ => μ α #

Instances

RestDeserializable ByteString # |
Methods getRest :: Deserializer μ => μ ByteString #
RestDeserializable ByteString # |
Methods getRest :: Deserializer μ => μ ByteString #
RestDeserializable ShortByteString # |
Methods getRest :: Deserializer μ => μ ShortByteString #
RestDeserializable Builder # |
Methods getRest :: Deserializer μ => μ Builder #
Deserializable α => RestDeserializable [α] # |
Methods getRest :: Deserializer μ => μ [α] #
(RestDeserializable α, RestDeserializable β) => RestDeserializable (Either α β) # |
Methods getRest :: Deserializer μ => μ (Either α β) #
(Deserializable α, RestDeserializable β) => RestDeserializable (α, β) # |
Methods getRest :: Deserializer μ => μ (α, β) #