bytes-0.17: Sharing code for serialization between binary and cereal

Copyright(c) Edward Kmett 2013-2015
LicenseBSD3
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellTrustworthy
LanguageHaskell98

Data.Bytes.Serial

Contents

Description

This module contains two main classes, each providing methods to serialize and deserialize types. Serial is the primary class, to be used for the canonical way to serialize a specific type. SerialEndian is used to provide endian-specific methods for serializing a type.

Synopsis

Serialization

class Serial a where Source #

Methods to serialize and deserialize type a to a binary representation

Instances provided here for fixed-with Integers and Words are big endian. Instances for strict and lazy bytestrings store also the length of bytestring big endian. Instances for Word and Int are host endian as they are machine-specific types.

Minimal complete definition

Nothing

Methods

serialize :: MonadPut m => a -> m () Source #

serialize :: (MonadPut m, GSerial (Rep a), Generic a) => a -> m () Source #

deserialize :: MonadGet m => m a Source #

deserialize :: (MonadGet m, GSerial (Rep a), Generic a) => m a Source #

Instances
Serial Bool Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Bool -> m () Source #

deserialize :: MonadGet m => m Bool Source #

Serial Char Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Char -> m () Source #

deserialize :: MonadGet m => m Char Source #

Serial Double Source # 
Instance details

Defined in Data.Bytes.Serial

Serial Float Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Float -> m () Source #

deserialize :: MonadGet m => m Float Source #

Serial Int Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Int -> m () Source #

deserialize :: MonadGet m => m Int Source #

Serial Int8 Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Int8 -> m () Source #

deserialize :: MonadGet m => m Int8 Source #

Serial Int16 Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Int16 -> m () Source #

deserialize :: MonadGet m => m Int16 Source #

Serial Int32 Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Int32 -> m () Source #

deserialize :: MonadGet m => m Int32 Source #

Serial Int64 Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Int64 -> m () Source #

deserialize :: MonadGet m => m Int64 Source #

Serial Integer Source #
>>> (runGetL deserialize $ runPutL $ serialize (1822304234^100::Integer))::Integer
115368812579128172803867366576339947332796540054052185472042218522037227934707037623902492207671987696439966697503243972076991940820348847422930433939639982092916577692754723458548819441583937289395076910527534916776189405228720063994377687015476947534961767053653973945346259230972683338173842343243493433367681264359887291905132383269175086733345253389374961758293922003996035662362278340494093804835649459223465051596978792130073960666112508481814461273829244289795707398202762289955919352549768394583446336873179280924584333491364188425976869717125645749497258775598562132278030402205794994603544837805140410310712693778605743100915046769381631247123664460203591228745772887977959388457679427407639421147498028487544882346912935398848298806021505673449774474457435816552278997100556732447852816961683577731381792363312695347606768120122976105200574809419685234274705929886121600174028733812771637390342332436695318974693376
Instance details

Defined in Data.Bytes.Serial

Serial Natural Source #
>>> runGetL deserialize (runPutL (serialize (10^10::Natural))) :: Natural
10000000000
Instance details

Defined in Data.Bytes.Serial

Serial Ordering Source #
>>> runGetL deserialize $ runPutL $ serialize LT::Ordering
LT
>>> runGetL deserialize $ runPutL $ serialize EQ::Ordering
EQ
>>> runGetL deserialize $ runPutL $ serialize GT::Ordering
GT
Instance details

Defined in Data.Bytes.Serial

Serial Word Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Word -> m () Source #

deserialize :: MonadGet m => m Word Source #

Serial Word8 Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Word8 -> m () Source #

deserialize :: MonadGet m => m Word8 Source #

Serial Word16 Source # 
Instance details

Defined in Data.Bytes.Serial

Serial Word32 Source # 
Instance details

Defined in Data.Bytes.Serial

Serial Word64 Source # 
Instance details

Defined in Data.Bytes.Serial

Serial () Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => () -> m () Source #

deserialize :: MonadGet m => m () Source #

Serial Void Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Void -> m () Source #

deserialize :: MonadGet m => m Void Source #

Serial Version Source # 
Instance details

Defined in Data.Bytes.Serial

Serial All Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => All -> m () Source #

deserialize :: MonadGet m => m All Source #

Serial Any Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Any -> m () Source #

deserialize :: MonadGet m => m Any Source #

Serial ByteString Source # 
Instance details

Defined in Data.Bytes.Serial

Serial ByteString Source # 
Instance details

Defined in Data.Bytes.Serial

Serial IntSet Source # 
Instance details

Defined in Data.Bytes.Serial

Serial Scientific Source # 
Instance details

Defined in Data.Bytes.Serial

Serial Text Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Text -> m () Source #

deserialize :: MonadGet m => m Text Source #

Serial Text Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Text -> m () Source #

deserialize :: MonadGet m => m Text Source #

Serial ZonedTime Source # 
Instance details

Defined in Data.Bytes.Serial

Serial LocalTime Source # 
Instance details

Defined in Data.Bytes.Serial

Serial TimeOfDay Source # 
Instance details

Defined in Data.Bytes.Serial

Serial TimeZone Source # 
Instance details

Defined in Data.Bytes.Serial

Serial UniversalTime Source #
>>> getModJulianDate $ (runGetL deserialize $ runPutL $ serialize (ModJulianDate $ 5 % 11)::UniversalTime)
5 % 11
Instance details

Defined in Data.Bytes.Serial

Serial UTCTime Source #
>>> (runGetL deserialize $ runPutL $ serialize (read "2014-01-01 10:54:42.478031 UTC"::UTCTime))::UTCTime
2014-01-01 10:54:42.478031 UTC
Instance details

Defined in Data.Bytes.Serial

Serial NominalDiffTime Source #
>>> (runGetL deserialize $ runPutL $ serialize (1.82::DiffTime))::DiffTime
1.82s
Instance details

Defined in Data.Bytes.Serial

Serial AbsoluteTime Source #
>>> (runGetL deserialize $ runPutL $ serialize (addAbsoluteTime 18.2 taiEpoch))::AbsoluteTime
1858-11-17 00:00:18.2 TAI
Instance details

Defined in Data.Bytes.Serial

Serial DiffTime Source #
>>> (runGetL deserialize $ runPutL $ serialize (1.82::DiffTime))::DiffTime
1.82s
Instance details

Defined in Data.Bytes.Serial

Serial Day Source #
>>> (runGetL deserialize $ runPutL $ serialize (ModifiedJulianDay 1))::Day
1858-11-18
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Day -> m () Source #

deserialize :: MonadGet m => m Day Source #

Serial a => Serial [a] Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => [a] -> m () Source #

deserialize :: MonadGet m => m [a] Source #

Serial a => Serial (Maybe a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Maybe a -> m () Source #

deserialize :: MonadGet m => m (Maybe a) Source #

(Serial a, Integral a) => Serial (Ratio a) Source #
>>> (runGetL deserialize $ runPutL $ serialize (5 % 11::Ratio Int))::Ratio Int
5 % 11
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Ratio a -> m () Source #

deserialize :: MonadGet m => m (Ratio a) Source #

HasResolution a => Serial (Fixed a) Source #
>>> (runGetL deserialize $ runPutL $ serialize (1.82::Fixed E2))::Fixed E2
1.82
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Fixed a -> m () Source #

deserialize :: MonadGet m => m (Fixed a) Source #

Serial a => Serial (ZipList a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => ZipList a -> m () Source #

deserialize :: MonadGet m => m (ZipList a) Source #

Serial a => Serial (Identity a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Identity a -> m () Source #

deserialize :: MonadGet m => m (Identity a) Source #

Serial a => Serial (First a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => First a -> m () Source #

deserialize :: MonadGet m => m (First a) Source #

Serial a => Serial (Last a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Last a -> m () Source #

deserialize :: MonadGet m => m (Last a) Source #

Serial a => Serial (Dual a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Dual a -> m () Source #

deserialize :: MonadGet m => m (Dual a) Source #

Serial a => Serial (Sum a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Sum a -> m () Source #

deserialize :: MonadGet m => m (Sum a) Source #

Serial a => Serial (Product a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Product a -> m () Source #

deserialize :: MonadGet m => m (Product a) Source #

Serial a => Serial (Down a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Down a -> m () Source #

deserialize :: MonadGet m => m (Down a) Source #

Serial a => Serial (NonEmpty a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => NonEmpty a -> m () Source #

deserialize :: MonadGet m => m (NonEmpty a) Source #

Serial v => Serial (IntMap v) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => IntMap v -> m () Source #

deserialize :: MonadGet m => m (IntMap v) Source #

Serial a => Serial (Seq a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Seq a -> m () Source #

deserialize :: MonadGet m => m (Seq a) Source #

(Serial a, Ord a) => Serial (Set a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Set a -> m () Source #

deserialize :: MonadGet m => m (Set a) Source #

(Serial v, Hashable v, Eq v) => Serial (HashSet v) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => HashSet v -> m () Source #

deserialize :: MonadGet m => m (HashSet v) Source #

(Bits n, Integral n, Bits (Unsigned n), Integral (Unsigned n)) => Serial (VarInt n) Source #

Integer/Word types serialized to base-128 variable-width ints.

>>> import Data.Monoid (mconcat)
>>> import qualified Data.ByteString.Lazy as BSL
>>> mconcat $ BSL.toChunks $ runPutL $ serialize (97 :: Word64)
"\NUL\NUL\NUL\NUL\NUL\NUL\NULa"
>>> mconcat $ BSL.toChunks $ runPutL $ serialize (97 :: VarInt Word64)
"a"
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => VarInt n -> m () Source #

deserialize :: MonadGet m => m (VarInt n) Source #

(Serial a, Serial b) => Serial (Either a b) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Either a b -> m () Source #

deserialize :: MonadGet m => m (Either a b) Source #

(Serial a, Serial b) => Serial (a, b) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => (a, b) -> m () Source #

deserialize :: MonadGet m => m (a, b) Source #

(Serial k, Serial v, Ord k) => Serial (Map k v) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Map k v -> m () Source #

deserialize :: MonadGet m => m (Map k v) Source #

(Serial k, Serial v, Hashable k, Eq k) => Serial (HashMap k v) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => HashMap k v -> m () Source #

deserialize :: MonadGet m => m (HashMap k v) Source #

(Serial a, Serial b, Serial c) => Serial (a, b, c) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => (a, b, c) -> m () Source #

deserialize :: MonadGet m => m (a, b, c) Source #

Serial (f a) => Serial (Reverse f a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Reverse f a -> m () Source #

deserialize :: MonadGet m => m (Reverse f a) Source #

Serial a => Serial (Constant a b) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Constant a b -> m () Source #

deserialize :: MonadGet m => m (Constant a b) Source #

(Serial a, Serial b, Serial c, Serial d) => Serial (a, b, c, d) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => (a, b, c, d) -> m () Source #

deserialize :: MonadGet m => m (a, b, c, d) Source #

(Serial (f a), Serial (g a)) => Serial (Product f g a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => Product f g a -> m () Source #

deserialize :: MonadGet m => m (Product f g a) Source #

(Serial a, Serial b, Serial c, Serial d, Serial e) => Serial (a, b, c, d, e) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serialize :: MonadPut m => (a, b, c, d, e) -> m () Source #

deserialize :: MonadGet m => m (a, b, c, d, e) Source #

Specifying endianness

class SerialEndian a where Source #

Methods to serialize and deserialize type a to a big and little endian binary representations. Methods suffixed with "host" are automatically defined to use equal the methods corresponding to the current machine's native endianness, but they can be overridden.

Minimal complete definition

Nothing

Instances
SerialEndian Char Source # 
Instance details

Defined in Data.Bytes.Serial

SerialEndian Double Source # 
Instance details

Defined in Data.Bytes.Serial

SerialEndian Float Source # 
Instance details

Defined in Data.Bytes.Serial

SerialEndian Int16 Source # 
Instance details

Defined in Data.Bytes.Serial

SerialEndian Int32 Source # 
Instance details

Defined in Data.Bytes.Serial

SerialEndian Int64 Source # 
Instance details

Defined in Data.Bytes.Serial

SerialEndian Word16 Source # 
Instance details

Defined in Data.Bytes.Serial

SerialEndian Word32 Source # 
Instance details

Defined in Data.Bytes.Serial

SerialEndian Word64 Source # 
Instance details

Defined in Data.Bytes.Serial

Higher-order

These classes provide us with the ability to serialize containers that need polymorphic recursion.

class Serial1 f where Source #

Minimal complete definition

Nothing

Methods

serializeWith :: MonadPut m => (a -> m ()) -> f a -> m () Source #

serializeWith :: (MonadPut m, GSerial1 (Rep1 f), Generic1 f) => (a -> m ()) -> f a -> m () Source #

deserializeWith :: MonadGet m => m a -> m (f a) Source #

deserializeWith :: (MonadGet m, GSerial1 (Rep1 f), Generic1 f) => m a -> m (f a) Source #

Instances
Serial1 [] Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a -> m ()) -> [a] -> m () Source #

deserializeWith :: MonadGet m => m a -> m [a] Source #

Serial1 Maybe Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a -> m ()) -> Maybe a -> m () Source #

deserializeWith :: MonadGet m => m a -> m (Maybe a) Source #

Serial1 NonEmpty Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a -> m ()) -> NonEmpty a -> m () Source #

deserializeWith :: MonadGet m => m a -> m (NonEmpty a) Source #

Serial1 IntMap Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a -> m ()) -> IntMap a -> m () Source #

deserializeWith :: MonadGet m => m a -> m (IntMap a) Source #

Serial1 Seq Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a -> m ()) -> Seq a -> m () Source #

deserializeWith :: MonadGet m => m a -> m (Seq a) Source #

Serial a => Serial1 (Either a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a0 -> m ()) -> Either a a0 -> m () Source #

deserializeWith :: MonadGet m => m a0 -> m (Either a a0) Source #

Serial a => Serial1 ((,) a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a0 -> m ()) -> (a, a0) -> m () Source #

deserializeWith :: MonadGet m => m a0 -> m (a, a0) Source #

(Ord k, Serial k) => Serial1 (Map k) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a -> m ()) -> Map k a -> m () Source #

deserializeWith :: MonadGet m => m a -> m (Map k a) Source #

(Hashable k, Eq k, Serial k) => Serial1 (HashMap k) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a -> m ()) -> HashMap k a -> m () Source #

deserializeWith :: MonadGet m => m a -> m (HashMap k a) Source #

(Serial a, Serial b) => Serial1 ((,,) a b) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a0 -> m ()) -> (a, b, a0) -> m () Source #

deserializeWith :: MonadGet m => m a0 -> m (a, b, a0) Source #

(Serial a, Serial b, Serial c) => Serial1 ((,,,) a b c) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a0 -> m ()) -> (a, b, c, a0) -> m () Source #

deserializeWith :: MonadGet m => m a0 -> m (a, b, c, a0) Source #

(Serial a, Serial b, Serial c, Serial d) => Serial1 ((,,,,) a b c d) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith :: MonadPut m => (a0 -> m ()) -> (a, b, c, d, a0) -> m () Source #

deserializeWith :: MonadGet m => m a0 -> m (a, b, c, d, a0) Source #

serialize1 :: (MonadPut m, Serial1 f, Serial a) => f a -> m () Source #

deserialize1 :: (MonadGet m, Serial1 f, Serial a) => m (f a) Source #

class Serial2 f where Source #

Methods

serializeWith2 :: MonadPut m => (a -> m ()) -> (b -> m ()) -> f a b -> m () Source #

deserializeWith2 :: MonadGet m => m a -> m b -> m (f a b) Source #

Instances
Serial2 Either Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith2 :: MonadPut m => (a -> m ()) -> (b -> m ()) -> Either a b -> m () Source #

deserializeWith2 :: MonadGet m => m a -> m b -> m (Either a b) Source #

Serial2 (,) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith2 :: MonadPut m => (a -> m ()) -> (b -> m ()) -> (a, b) -> m () Source #

deserializeWith2 :: MonadGet m => m a -> m b -> m (a, b) Source #

Serial a => Serial2 ((,,) a) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith2 :: MonadPut m => (a0 -> m ()) -> (b -> m ()) -> (a, a0, b) -> m () Source #

deserializeWith2 :: MonadGet m => m a0 -> m b -> m (a, a0, b) Source #

(Serial a, Serial b) => Serial2 ((,,,) a b) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith2 :: MonadPut m => (a0 -> m ()) -> (b0 -> m ()) -> (a, b, a0, b0) -> m () Source #

deserializeWith2 :: MonadGet m => m a0 -> m b0 -> m (a, b, a0, b0) Source #

(Serial a, Serial b, Serial c) => Serial2 ((,,,,) a b c) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

serializeWith2 :: MonadPut m => (a0 -> m ()) -> (b0 -> m ()) -> (a, b, c, a0, b0) -> m () Source #

deserializeWith2 :: MonadGet m => m a0 -> m b0 -> m (a, b, c, a0, b0) Source #

serialize2 :: (MonadPut m, Serial2 f, Serial a, Serial b) => f a b -> m () Source #

deserialize2 :: (MonadGet m, Serial2 f, Serial a, Serial b) => m (f a b) Source #

Storable

store :: (MonadPut m, Storable a) => a -> m () Source #

serialize any Storable in a host-specific format.

restore :: forall m a. (MonadGet m, Storable a) => m a Source #

deserialize any Storable in a host-specific format.

Generics

You probably will never need to care that these exist except they provide us with default definitions for Serial and SerialEndian

class GSerial f where Source #

Used internally to provide generic serialization

Methods

gserialize :: MonadPut m => f a -> m () Source #

gdeserialize :: MonadGet m => m (f a) Source #

Instances
GSerial (V1 :: Type -> Type) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserialize :: MonadPut m => V1 a -> m () Source #

gdeserialize :: MonadGet m => m (V1 a) Source #

GSerial (U1 :: Type -> Type) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserialize :: MonadPut m => U1 a -> m () Source #

gdeserialize :: MonadGet m => m (U1 a) Source #

Serial a => GSerial (K1 i a :: Type -> Type) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserialize :: MonadPut m => K1 i a a0 -> m () Source #

gdeserialize :: MonadGet m => m (K1 i a a0) Source #

(GSerial f, GSerial g) => GSerial (f :+: g) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserialize :: MonadPut m => (f :+: g) a -> m () Source #

gdeserialize :: MonadGet m => m ((f :+: g) a) Source #

(GSerial f, GSerial g) => GSerial (f :*: g) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserialize :: MonadPut m => (f :*: g) a -> m () Source #

gdeserialize :: MonadGet m => m ((f :*: g) a) Source #

GSerial f => GSerial (M1 i c f) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserialize :: MonadPut m => M1 i c f a -> m () Source #

gdeserialize :: MonadGet m => m (M1 i c f a) Source #

class GSerialEndian f where Source #

Used internally to provide generic big-endian serialization

Minimal complete definition

Nothing

Methods

gserializeBE :: MonadPut m => f a -> m () Source #

gserializeBE :: (MonadPut m, GSerial f) => f a -> m () Source #

gdeserializeBE :: MonadGet m => m (f a) Source #

gdeserializeBE :: (MonadGet m, GSerial f) => m (f a) Source #

gserializeLE :: MonadPut m => f a -> m () Source #

gserializeLE :: (MonadPut m, GSerial f) => f a -> m () Source #

gdeserializeLE :: MonadGet m => m (f a) Source #

gdeserializeLE :: (MonadGet m, GSerial f) => m (f a) Source #

Instances
SerialEndian a => GSerialEndian (K1 i a :: Type -> Type) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserializeBE :: MonadPut m => K1 i a a0 -> m () Source #

gdeserializeBE :: MonadGet m => m (K1 i a a0) Source #

gserializeLE :: MonadPut m => K1 i a a0 -> m () Source #

gdeserializeLE :: MonadGet m => m (K1 i a a0) Source #

class GSerial1 f where Source #

Used internally to provide generic serialization

Methods

gserializeWith :: MonadPut m => (a -> m ()) -> f a -> m () Source #

gdeserializeWith :: MonadGet m => m a -> m (f a) Source #

Instances
GSerial1 Par1 Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserializeWith :: MonadPut m => (a -> m ()) -> Par1 a -> m () Source #

gdeserializeWith :: MonadGet m => m a -> m (Par1 a) Source #

GSerial1 (V1 :: Type -> Type) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserializeWith :: MonadPut m => (a -> m ()) -> V1 a -> m () Source #

gdeserializeWith :: MonadGet m => m a -> m (V1 a) Source #

GSerial1 (U1 :: Type -> Type) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserializeWith :: MonadPut m => (a -> m ()) -> U1 a -> m () Source #

gdeserializeWith :: MonadGet m => m a -> m (U1 a) Source #

Serial1 f => GSerial1 (Rec1 f) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserializeWith :: MonadPut m => (a -> m ()) -> Rec1 f a -> m () Source #

gdeserializeWith :: MonadGet m => m a -> m (Rec1 f a) Source #

Serial a => GSerial1 (K1 i a :: Type -> Type) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserializeWith :: MonadPut m => (a0 -> m ()) -> K1 i a a0 -> m () Source #

gdeserializeWith :: MonadGet m => m a0 -> m (K1 i a a0) Source #

(GSerial1 f, GSerial1 g) => GSerial1 (f :+: g) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserializeWith :: MonadPut m => (a -> m ()) -> (f :+: g) a -> m () Source #

gdeserializeWith :: MonadGet m => m a -> m ((f :+: g) a) Source #

(GSerial1 f, GSerial1 g) => GSerial1 (f :*: g) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserializeWith :: MonadPut m => (a -> m ()) -> (f :*: g) a -> m () Source #

gdeserializeWith :: MonadGet m => m a -> m ((f :*: g) a) Source #

GSerial1 f => GSerial1 (M1 i c f) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserializeWith :: MonadPut m => (a -> m ()) -> M1 i c f a -> m () Source #

gdeserializeWith :: MonadGet m => m a -> m (M1 i c f a) Source #

(Serial1 f, GSerial1 g) => GSerial1 (f :.: g) Source # 
Instance details

Defined in Data.Bytes.Serial

Methods

gserializeWith :: MonadPut m => (a -> m ()) -> (f :.: g) a -> m () Source #

gdeserializeWith :: MonadGet m => m a -> m ((f :.: g) a) Source #