data-serializer-0.3: Common API for serialization libraries

Safe Haskell | None
Language | Haskell2010

Data.Serializer

Contents

- Serialization monoid
  - Binary words serialization
  - Endian serializers
- Serializable types

Description

Serialization monoid and serializable types.

Synopsis

- class (Semigroup s, Monoid s) => Serializer s where
- newtype BinarySerializer = BinarySerializer {
  - binarySerializer :: Put
  }
- newtype CerealSerializer = CerealSerializer {
  - cerealSerializer :: Put
  }
- word16H :: Serializer s => Word16 -> s
- word32H :: Serializer s => Word32 -> s
- word64H :: Serializer s => Word64 -> s
- word :: Serializer s => Word -> s
- wordL :: Serializer s => Word -> s
- wordB :: Serializer s => Word -> s
- wordH :: Serializer s => Word -> s
- int8 :: Serializer s => Int8 -> s
- int16 :: Serializer s => Int16 -> s
- int16L :: Serializer s => Int16 -> s
- int16B :: Serializer s => Int16 -> s
- int16H :: Serializer s => Int16 -> s
- int32 :: Serializer s => Int32 -> s
- int32L :: Serializer s => Int32 -> s
- int32B :: Serializer s => Int32 -> s
- int32H :: Serializer s => Int32 -> s
- int64 :: Serializer s => Int64 -> s
- int64L :: Serializer s => Int64 -> s
- int64B :: Serializer s => Int64 -> s
- int64H :: Serializer s => Int64 -> s
- int :: Serializer s => Int -> s
- intL :: Serializer s => Int -> s
- intB :: Serializer s => Int64 -> s
- intH :: Serializer s => Int -> s
- newtype LittleEndianSerializer s = LittleEndianSerializer {
  - serializeL :: s
  }
- newtype BigEndianSerializer s = BigEndianSerializer {
  - serializeB :: s
  }
- serializeIn :: Serializer s => Endian -> (forall s'. Serializer s' => s') -> s
- serializeH :: Serializer s => (forall s'. Serializer s' => s') -> s
- class Serializable α where
- putIn :: (Serializer s, Serializable α) => Endian -> α -> s
- putL :: (Serializer s, Serializable α) => α -> s
- putB :: (Serializer s, Serializable α) => α -> s
- putH :: (Serializer s, Serializable α) => α -> s
- class Serializable α => SizedSerializable α where
- class RestSerializable α where

# Serialization monoid

class (Semigroup s, Monoid s) => Serializer s where #

Serialization monoid.

Minimal complete definition

word8

Methods

endian :: Proxy s -> Endian #

Default byte order of the serializer.

word8 :: Word8 -> s #

Serialize a byte. `word8` x = `byteString` (`singleton` x)

word16 :: Word16 -> s #

Serialize an unsigned 16-bit integer in the default byte order.

word32 :: Word32 -> s #

Serialize an unsigned 32-bit integer in the default byte order.

word64 :: Word64 -> s #

Serialize an unsigned 64-bit integer in the default byte order.

word16L :: Word16 -> s #

Serialize an unsigned 16-bit integer in little endian.

word16B :: Word16 -> s #

Serialize an unsigned 16-bit integer in big endian.

word32L :: Word32 -> s #

Serialize an unsigned 32-bit integer in little endian.

word32B :: Word32 -> s #

Serialize an unsigned 32-bit integer in big endian.

word64L :: Word64 -> s #

Serialize an unsigned 64-bit integer in little endian.

word64B :: Word64 -> s #

Serialize an unsigned 64-bit integer in big endian.

byteString :: ByteString -> s #

Serialize a `ByteString`. Must be a monoid homomorphism.

shortByteString :: ShortByteString -> s #

Serialize a `ShortByteString`. Must be a monoid homomorphism.

lazyByteString :: ByteString -> s #

Serialize a lazy `ByteString`. Must be a monoid homomorphism.

builder :: Builder -> s #

Serialize a `Builder`. Must be a monoid homomorphism.

Instances

Serializer Put # |
Methods endian :: Proxy * Put -> Endian # word8 :: Word8 -> Put # word16 :: Word16 -> Put # word32 :: Word32 -> Put # word64 :: Word64 -> Put # word16L :: Word16 -> Put # word16B :: Word16 -> Put # word32L :: Word32 -> Put # word32B :: Word32 -> Put # word64L :: Word64 -> Put # word64B :: Word64 -> Put # byteString :: ByteString -> Put # shortByteString :: ShortByteString -> Put # lazyByteString :: ByteString -> Put # builder :: Builder -> Put #
Serializer Builder # |
Methods endian :: Proxy * Builder -> Endian # word8 :: Word8 -> Builder # word16 :: Word16 -> Builder # word32 :: Word32 -> Builder # word64 :: Word64 -> Builder # word16L :: Word16 -> Builder # word16B :: Word16 -> Builder # word32L :: Word32 -> Builder # word32B :: Word32 -> Builder # word64L :: Word64 -> Builder # word64B :: Word64 -> Builder # byteString :: ByteString -> Builder # shortByteString :: ShortByteString -> Builder # lazyByteString :: ByteString -> Builder # builder :: Builder -> Builder #
Serializer CerealSerializer # |
Methods endian :: Proxy * CerealSerializer -> Endian # word8 :: Word8 -> CerealSerializer # word16 :: Word16 -> CerealSerializer # word32 :: Word32 -> CerealSerializer # word64 :: Word64 -> CerealSerializer # word16L :: Word16 -> CerealSerializer # word16B :: Word16 -> CerealSerializer # word32L :: Word32 -> CerealSerializer # word32B :: Word32 -> CerealSerializer # word64L :: Word64 -> CerealSerializer # word64B :: Word64 -> CerealSerializer # byteString :: ByteString -> CerealSerializer # shortByteString :: ShortByteString -> CerealSerializer # lazyByteString :: ByteString -> CerealSerializer # builder :: Builder -> CerealSerializer #
Serializer BinarySerializer # |
Methods endian :: Proxy * BinarySerializer -> Endian # word8 :: Word8 -> BinarySerializer # word16 :: Word16 -> BinarySerializer # word32 :: Word32 -> BinarySerializer # word64 :: Word64 -> BinarySerializer # word16L :: Word16 -> BinarySerializer # word16B :: Word16 -> BinarySerializer # word32L :: Word32 -> BinarySerializer # word32B :: Word32 -> BinarySerializer # word64L :: Word64 -> BinarySerializer # word64B :: Word64 -> BinarySerializer # byteString :: ByteString -> BinarySerializer # shortByteString :: ShortByteString -> BinarySerializer # lazyByteString :: ByteString -> BinarySerializer # builder :: Builder -> BinarySerializer #
Serializer [Word8] # |
Methods endian :: Proxy * [Word8] -> Endian # word8 :: Word8 -> [Word8] # word16 :: Word16 -> [Word8] # word32 :: Word32 -> [Word8] # word64 :: Word64 -> [Word8] # word16L :: Word16 -> [Word8] # word16B :: Word16 -> [Word8] # word32L :: Word32 -> [Word8] # word32B :: Word32 -> [Word8] # word64L :: Word64 -> [Word8] # word64B :: Word64 -> [Word8] # byteString :: ByteString -> [Word8] # shortByteString :: ShortByteString -> [Word8] # lazyByteString :: ByteString -> [Word8] # builder :: Builder -> [Word8] #
Serializer s => Serializer (BigEndianSerializer s) # |
Methods endian :: Proxy * (BigEndianSerializer s) -> Endian # word8 :: Word8 -> BigEndianSerializer s # word16 :: Word16 -> BigEndianSerializer s # word32 :: Word32 -> BigEndianSerializer s # word64 :: Word64 -> BigEndianSerializer s # word16L :: Word16 -> BigEndianSerializer s # word16B :: Word16 -> BigEndianSerializer s # word32L :: Word32 -> BigEndianSerializer s # word32B :: Word32 -> BigEndianSerializer s # word64L :: Word64 -> BigEndianSerializer s # word64B :: Word64 -> BigEndianSerializer s # byteString :: ByteString -> BigEndianSerializer s # shortByteString :: ShortByteString -> BigEndianSerializer s # lazyByteString :: ByteString -> BigEndianSerializer s # builder :: Builder -> BigEndianSerializer s #
Serializer s => Serializer (LittleEndianSerializer s) # |
Methods endian :: Proxy * (LittleEndianSerializer s) -> Endian # word8 :: Word8 -> LittleEndianSerializer s # word16 :: Word16 -> LittleEndianSerializer s # word32 :: Word32 -> LittleEndianSerializer s # word64 :: Word64 -> LittleEndianSerializer s # word16L :: Word16 -> LittleEndianSerializer s # word16B :: Word16 -> LittleEndianSerializer s # word32L :: Word32 -> LittleEndianSerializer s # word32B :: Word32 -> LittleEndianSerializer s # word64L :: Word64 -> LittleEndianSerializer s # word64B :: Word64 -> LittleEndianSerializer s # byteString :: ByteString -> LittleEndianSerializer s # shortByteString :: ShortByteString -> LittleEndianSerializer s # lazyByteString :: ByteString -> LittleEndianSerializer s # builder :: Builder -> LittleEndianSerializer s #

newtype BinarySerializer #

A wrapper around the `Put` monoid (to avoid orphan instances).

Constructors

BinarySerializer |
Fields binarySerializer :: Put

Instances

Generic BinarySerializer # |
Associated Types type Rep BinarySerializer :: * -> * # Methods from :: BinarySerializer -> Rep BinarySerializer x # to :: Rep BinarySerializer x -> BinarySerializer #
Semigroup BinarySerializer # |
Methods (<>) :: BinarySerializer -> BinarySerializer -> BinarySerializer # sconcat :: NonEmpty BinarySerializer -> BinarySerializer # stimes :: Integral b => b -> BinarySerializer -> BinarySerializer #
Monoid BinarySerializer # |
Methods mempty :: BinarySerializer # mappend :: BinarySerializer -> BinarySerializer -> BinarySerializer # mconcat :: [BinarySerializer] -> BinarySerializer #
Serializer BinarySerializer # |
Methods endian :: Proxy * BinarySerializer -> Endian # word8 :: Word8 -> BinarySerializer # word16 :: Word16 -> BinarySerializer # word32 :: Word32 -> BinarySerializer # word64 :: Word64 -> BinarySerializer # word16L :: Word16 -> BinarySerializer # word16B :: Word16 -> BinarySerializer # word32L :: Word32 -> BinarySerializer # word32B :: Word32 -> BinarySerializer # word64L :: Word64 -> BinarySerializer # word64B :: Word64 -> BinarySerializer # byteString :: ByteString -> BinarySerializer # shortByteString :: ShortByteString -> BinarySerializer # lazyByteString :: ByteString -> BinarySerializer # builder :: Builder -> BinarySerializer #
type Rep BinarySerializer # |
type Rep BinarySerializer = D1 (MetaData "BinarySerializer" "Data.Serializer" "data-serializer-0.3-JoyqVvKpQJs1Y9RiBrhPT0" True) (C1 (MetaCons "BinarySerializer" PrefixI True) (S1 (MetaSel (Just Symbol "binarySerializer") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Put)))

newtype CerealSerializer #

A wrapper around the `Put` monoid (to avoid orphan instances).

Constructors

CerealSerializer |
Fields cerealSerializer :: Put

Instances

Generic CerealSerializer # |
Associated Types type Rep CerealSerializer :: * -> * # Methods from :: CerealSerializer -> Rep CerealSerializer x # to :: Rep CerealSerializer x -> CerealSerializer #
Semigroup CerealSerializer # |
Methods (<>) :: CerealSerializer -> CerealSerializer -> CerealSerializer # sconcat :: NonEmpty CerealSerializer -> CerealSerializer # stimes :: Integral b => b -> CerealSerializer -> CerealSerializer #
Monoid CerealSerializer # |
Methods mempty :: CerealSerializer # mappend :: CerealSerializer -> CerealSerializer -> CerealSerializer # mconcat :: [CerealSerializer] -> CerealSerializer #
Serializer CerealSerializer # |
Methods endian :: Proxy * CerealSerializer -> Endian # word8 :: Word8 -> CerealSerializer # word16 :: Word16 -> CerealSerializer # word32 :: Word32 -> CerealSerializer # word64 :: Word64 -> CerealSerializer # word16L :: Word16 -> CerealSerializer # word16B :: Word16 -> CerealSerializer # word32L :: Word32 -> CerealSerializer # word32B :: Word32 -> CerealSerializer # word64L :: Word64 -> CerealSerializer # word64B :: Word64 -> CerealSerializer # byteString :: ByteString -> CerealSerializer # shortByteString :: ShortByteString -> CerealSerializer # lazyByteString :: ByteString -> CerealSerializer # builder :: Builder -> CerealSerializer #
type Rep CerealSerializer # |
type Rep CerealSerializer = D1 (MetaData "CerealSerializer" "Data.Serializer" "data-serializer-0.3-JoyqVvKpQJs1Y9RiBrhPT0" True) (C1 (MetaCons "CerealSerializer" PrefixI True) (S1 (MetaSel (Just Symbol "cerealSerializer") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 Put)))

## Binary words serialization

word16H :: Serializer s => Word16 -> s #

Serialize an usigned 16-bit integer in host byte order.

word32H :: Serializer s => Word32 -> s #

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

word64H :: Serializer s => Word64 -> s #

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

word :: Serializer s => Word -> s #

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

wordL :: Serializer s => Word -> s #

Serialize an unsigned native-sized integer in little endian.

wordB :: Serializer s => Word -> s #

Serialize an unsigned native-sized integer in big endian.

wordH :: Serializer s => Word -> s #

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

int8 :: Serializer s => Int8 -> s #

Serialize a signed 8-bit integer.

int16 :: Serializer s => Int16 -> s #

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

int16L :: Serializer s => Int16 -> s #

Serialize a signed 16-bit integer in little endian.

int16B :: Serializer s => Int16 -> s #

Serialize a signed 16-bit integer in big endian.

int16H :: Serializer s => Int16 -> s #

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

int32 :: Serializer s => Int32 -> s #

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

int32L :: Serializer s => Int32 -> s #

Serialize a signed 32-bit integer in little endian.

int32B :: Serializer s => Int32 -> s #

Serialize a signed 32-bit integer in big endian.

int32H :: Serializer s => Int32 -> s #

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

int64 :: Serializer s => Int64 -> s #

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

int64L :: Serializer s => Int64 -> s #

Serialize a signed 64-bit integer in little endian.

int64B :: Serializer s => Int64 -> s #

Serialize a signed 64-bit integer in big endian.

int64H :: Serializer s => Int64 -> s #

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

int :: Serializer s => Int -> s #

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

intL :: Serializer s => Int -> s #

Serialize a signed native-sized integer in little endian.

intB :: Serializer s => Int64 -> s #

Serialize a signed native-sized integer in big endian.

intH :: Serializer s => Int -> s #

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

## Endian serializers

newtype LittleEndianSerializer s #

Serializer wrapper with little endian default byte order.

Constructors

LittleEndianSerializer |
Fields serializeL :: s

Instances

Data s => Data (LittleEndianSerializer s) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> LittleEndianSerializer s -> c (LittleEndianSerializer s) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (LittleEndianSerializer s) # toConstr :: LittleEndianSerializer s -> Constr # dataTypeOf :: LittleEndianSerializer s -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (LittleEndianSerializer s)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (LittleEndianSerializer s)) # gmapT :: (forall b. Data b => b -> b) -> LittleEndianSerializer s -> LittleEndianSerializer s # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> LittleEndianSerializer s -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> LittleEndianSerializer s -> r # gmapQ :: (forall d. Data d => d -> u) -> LittleEndianSerializer s -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> LittleEndianSerializer s -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> LittleEndianSerializer s -> m (LittleEndianSerializer s) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> LittleEndianSerializer s -> m (LittleEndianSerializer s) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> LittleEndianSerializer s -> m (LittleEndianSerializer s) #
Generic (LittleEndianSerializer s) # |
Associated Types type Rep (LittleEndianSerializer s) :: * -> * # Methods from :: LittleEndianSerializer s -> Rep (LittleEndianSerializer s) x # to :: Rep (LittleEndianSerializer s) x -> LittleEndianSerializer s #
Semigroup s => Semigroup (LittleEndianSerializer s) # |
Methods (<>) :: LittleEndianSerializer s -> LittleEndianSerializer s -> LittleEndianSerializer s # sconcat :: NonEmpty (LittleEndianSerializer s) -> LittleEndianSerializer s # stimes :: Integral b => b -> LittleEndianSerializer s -> LittleEndianSerializer s #
Monoid s => Monoid (LittleEndianSerializer s) # |
Methods mempty :: LittleEndianSerializer s # mappend :: LittleEndianSerializer s -> LittleEndianSerializer s -> LittleEndianSerializer s # mconcat :: [LittleEndianSerializer s] -> LittleEndianSerializer s #
Serializer s => Serializer (LittleEndianSerializer s) # |
Methods endian :: Proxy * (LittleEndianSerializer s) -> Endian # word8 :: Word8 -> LittleEndianSerializer s # word16 :: Word16 -> LittleEndianSerializer s # word32 :: Word32 -> LittleEndianSerializer s # word64 :: Word64 -> LittleEndianSerializer s # word16L :: Word16 -> LittleEndianSerializer s # word16B :: Word16 -> LittleEndianSerializer s # word32L :: Word32 -> LittleEndianSerializer s # word32B :: Word32 -> LittleEndianSerializer s # word64L :: Word64 -> LittleEndianSerializer s # word64B :: Word64 -> LittleEndianSerializer s # byteString :: ByteString -> LittleEndianSerializer s # shortByteString :: ShortByteString -> LittleEndianSerializer s # lazyByteString :: ByteString -> LittleEndianSerializer s # builder :: Builder -> LittleEndianSerializer s #
type Rep (LittleEndianSerializer s) # |
type Rep (LittleEndianSerializer s) = D1 (MetaData "LittleEndianSerializer" "Data.Serializer" "data-serializer-0.3-JoyqVvKpQJs1Y9RiBrhPT0" True) (C1 (MetaCons "LittleEndianSerializer" PrefixI True) (S1 (MetaSel (Just Symbol "serializeL") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 s)))

newtype BigEndianSerializer s #

Serializer wrapper with big endian default byte order.

Constructors

BigEndianSerializer |
Fields serializeB :: s

Instances

Data s => Data (BigEndianSerializer s) # |
Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> BigEndianSerializer s -> c (BigEndianSerializer s) # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (BigEndianSerializer s) # toConstr :: BigEndianSerializer s -> Constr # dataTypeOf :: BigEndianSerializer s -> DataType # dataCast1 :: Typeable (* -> *) t => (forall d. Data d => c (t d)) -> Maybe (c (BigEndianSerializer s)) # dataCast2 :: Typeable (* -> * -> *) t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (BigEndianSerializer s)) # gmapT :: (forall b. Data b => b -> b) -> BigEndianSerializer s -> BigEndianSerializer s # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> BigEndianSerializer s -> r # gmapQr :: (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> BigEndianSerializer s -> r # gmapQ :: (forall d. Data d => d -> u) -> BigEndianSerializer s -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> BigEndianSerializer s -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> BigEndianSerializer s -> m (BigEndianSerializer s) # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> BigEndianSerializer s -> m (BigEndianSerializer s) # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> BigEndianSerializer s -> m (BigEndianSerializer s) #
Generic (BigEndianSerializer s) # |
Associated Types type Rep (BigEndianSerializer s) :: * -> * # Methods from :: BigEndianSerializer s -> Rep (BigEndianSerializer s) x # to :: Rep (BigEndianSerializer s) x -> BigEndianSerializer s #
Semigroup s => Semigroup (BigEndianSerializer s) # |
Methods (<>) :: BigEndianSerializer s -> BigEndianSerializer s -> BigEndianSerializer s # sconcat :: NonEmpty (BigEndianSerializer s) -> BigEndianSerializer s # stimes :: Integral b => b -> BigEndianSerializer s -> BigEndianSerializer s #
Monoid s => Monoid (BigEndianSerializer s) # |
Methods mempty :: BigEndianSerializer s # mappend :: BigEndianSerializer s -> BigEndianSerializer s -> BigEndianSerializer s # mconcat :: [BigEndianSerializer s] -> BigEndianSerializer s #
Serializer s => Serializer (BigEndianSerializer s) # |
Methods endian :: Proxy * (BigEndianSerializer s) -> Endian # word8 :: Word8 -> BigEndianSerializer s # word16 :: Word16 -> BigEndianSerializer s # word32 :: Word32 -> BigEndianSerializer s # word64 :: Word64 -> BigEndianSerializer s # word16L :: Word16 -> BigEndianSerializer s # word16B :: Word16 -> BigEndianSerializer s # word32L :: Word32 -> BigEndianSerializer s # word32B :: Word32 -> BigEndianSerializer s # word64L :: Word64 -> BigEndianSerializer s # word64B :: Word64 -> BigEndianSerializer s # byteString :: ByteString -> BigEndianSerializer s # shortByteString :: ShortByteString -> BigEndianSerializer s # lazyByteString :: ByteString -> BigEndianSerializer s # builder :: Builder -> BigEndianSerializer s #
type Rep (BigEndianSerializer s) # |
type Rep (BigEndianSerializer s) = D1 (MetaData "BigEndianSerializer" "Data.Serializer" "data-serializer-0.3-JoyqVvKpQJs1Y9RiBrhPT0" True) (C1 (MetaCons "BigEndianSerializer" PrefixI True) (S1 (MetaSel (Just Symbol "serializeB") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 s)))

serializeIn :: Serializer s => Endian -> (forall s'. Serializer s' => s') -> s #

Force the default byte order.

serializeH :: Serializer s => (forall s'. Serializer s' => s') -> s #

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

# Serializable types

class Serializable α where #

Serializable type. `put` must work under assumption that it will be followed by more output.

Minimal complete definition

put

Methods

put :: Serializer s => α -> s #

Instances

Serializable Bool # |
Methods put :: Serializer s => Bool -> s #
Serializable Int # |
Methods put :: Serializer s => Int -> s #
Serializable Int8 # |
Methods put :: Serializer s => Int8 -> s #
Serializable Int16 # |
Methods put :: Serializer s => Int16 -> s #
Serializable Int32 # |
Methods put :: Serializer s => Int32 -> s #
Serializable Int64 # |
Methods put :: Serializer s => Int64 -> s #
Serializable Word # |
Methods put :: Serializer s => Word -> s #
Serializable Word8 # |
Methods put :: Serializer s => Word8 -> s #
Serializable Word16 # |
Methods put :: Serializer s => Word16 -> s #
Serializable Word32 # |
Methods put :: Serializer s => Word32 -> s #
Serializable Word64 # |
Methods put :: Serializer s => Word64 -> s #
Serializable ByteString # |
Methods put :: Serializer s => ByteString -> s #
Serializable ShortByteString # |
Methods put :: Serializer s => ShortByteString -> s #
Serializable α => Serializable (Maybe α) # |
Methods put :: Serializer s => Maybe α -> s #
(Serializable α, Serializable β) => Serializable (Either α β) # |
Methods put :: Serializer s => Either α β -> s #
(Serializable α, Serializable β) => Serializable (α, β) # |
Methods put :: Serializer s => (α, β) -> s #

putIn :: (Serializer s, Serializable α) => Endian -> α -> s #

Serialize a value using the provided default byte order.

putL :: (Serializer s, Serializable α) => α -> s #

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

putB :: (Serializer s, Serializable α) => α -> s #

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

putH :: (Serializer s, Serializable α) => α -> s #

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

class Serializable α => SizedSerializable α where #

Types with fixed serialized size.

Minimal complete definition

size

Methods

size :: Proxy α -> Int #

Serialized size in bytes.

Instances

SizedSerializable Bool # |
Methods size :: Proxy * Bool -> Int #
SizedSerializable Int # |
Methods size :: Proxy * Int -> Int #
SizedSerializable Int8 # |
Methods size :: Proxy * Int8 -> Int #
SizedSerializable Int16 # |
Methods size :: Proxy * Int16 -> Int #
SizedSerializable Int32 # |
Methods size :: Proxy * Int32 -> Int #
SizedSerializable Int64 # |
Methods size :: Proxy * Int64 -> Int #
SizedSerializable Word # |
Methods size :: Proxy * Word -> Int #
SizedSerializable Word8 # |
Methods size :: Proxy * Word8 -> Int #
SizedSerializable Word16 # |
Methods size :: Proxy * Word16 -> Int #
SizedSerializable Word32 # |
Methods size :: Proxy * Word32 -> Int #
SizedSerializable Word64 # |
Methods size :: Proxy * Word64 -> Int #
(SizedSerializable α, SizedSerializable β) => SizedSerializable (α, β) # |
Methods size :: Proxy * (α, β) -> Int #

class RestSerializable α where #

Serializable type. `putRest` must work under assumption that it will not be followed by any more output.

Minimal complete definition

putRest

Methods

putRest :: Serializer s => α -> s #

Instances

RestSerializable ByteString # |
Methods putRest :: Serializer s => ByteString -> s #
RestSerializable ByteString # |
Methods putRest :: Serializer s => ByteString -> s #
RestSerializable ShortByteString # |
Methods putRest :: Serializer s => ShortByteString -> s #
RestSerializable Builder # |
Methods putRest :: Serializer s => Builder -> s #
Serializable α => RestSerializable [α] # |
Methods putRest :: Serializer s => [α] -> s #
(Serializable α, RestSerializable β) => RestSerializable (α, β) # |
Methods putRest :: Serializer s => (α, β) -> s #