Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Serialization using the bytezap library.
bytezap serializers ("pokes") work by writing bytes into a pointer, which is
assumed to have _precisely_ the space required. The user must determine the
post-serialize length before the fact. For that reason, this module requires
that types to be serialized have a BLen
instance. In general, we are happy
about this, because a binrep type should always have an efficient and preferably
simple BLen
instance (and if not, it shouldn't be a binrep type).
Synopsis
- class Put a where
- runPut :: (BLen a, Put a) => a -> ByteString
- putGenericNonSum :: forall {cd} {f} {asserts} a. (Generic a, Rep a ~ D1 cd f, GFoldMapNonSum Poke f, asserts ~ '['NoEmpty, 'NoSum], ApplyGCAsserts asserts f) => a -> Poke
- putGenericSum :: forall {cd} {f} {asserts} a. (Generic a, Rep a ~ D1 cd f, GFoldMapSum 'SumOnly Poke f, asserts ~ '['NoEmpty, 'NeedSum], ApplyGCAsserts asserts f) => (String -> Poke) -> a -> Poke
Documentation
Instances
putGenericNonSum :: forall {cd} {f} {asserts} a. (Generic a, Rep a ~ D1 cd f, GFoldMapNonSum Poke f, asserts ~ '['NoEmpty, 'NoSum], ApplyGCAsserts asserts f) => a -> Poke Source #
Serialize a term of the non-sum type a
via its Generic
instance.
putGenericSum :: forall {cd} {f} {asserts} a. (Generic a, Rep a ~ D1 cd f, GFoldMapSum 'SumOnly Poke f, asserts ~ '['NoEmpty, 'NeedSum], ApplyGCAsserts asserts f) => (String -> Poke) -> a -> Poke Source #
Orphan instances
GenericFoldMap Poke Source # | |
type GenericFoldMapC Poke a # genericFoldMapF :: GenericFoldMapC Poke a => a -> Poke # |