Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- type Builder = BuilderFor StrictByteStringBackend
- class Put a where
- runPut :: Put a => a -> ByteString
- runBuilder :: Builder -> ByteString
- putGenericNonSum :: forall {cd} {f} {asserts} a. (Generic a, Rep a ~ D1 cd f, GFoldMapNonSum Builder f, asserts ~ '['NoEmpty, 'NoSum], ApplyGCAsserts asserts f) => a -> Builder
- putGenericSum :: forall {cd} {f} {asserts} a. (Generic a, Rep a ~ D1 cd f, GFoldMapSum 'SumOnly Builder f, asserts ~ '['NoEmpty, 'NeedSum], ApplyGCAsserts asserts f) => (String -> Builder) -> a -> Builder
- class PutWith r a where
- putWithout :: Put a => a -> Either String Builder
- runPutWith :: PutWith r a => r -> a -> Either String ByteString
Documentation
Instances
Put Void Source # | Impossible to serialize |
Put Int8 Source # | |
Put Word8 Source # | |
Put ByteString Source # | Serialize the bytestring as-is. Careful -- the only way you're going to be able to parse this is to read until EOF. |
Defined in Binrep.Put.Mason put :: ByteString -> Builder Source # | |
Put a => Put (Binreply a) Source # | |
Put a => Put [a] Source # | Serialize each element in order. No length indicator, so parse until either error or EOF. Usually not what you want, but sometimes used at the "top" of binary formats. |
Defined in Binrep.Put.Mason | |
Put (Endian end Int8) Source # | Endianness doesn't matter for single bytes. |
Put (Endian end Word8) Source # | Endianness doesn't matter for single bytes. |
(Put a, Put b) => Put (a, b) Source # | |
Defined in Binrep.Put.Mason |
runPut :: Put a => a -> ByteString Source #
Run the serializer.
runBuilder :: Builder -> ByteString Source #
putGenericNonSum :: forall {cd} {f} {asserts} a. (Generic a, Rep a ~ D1 cd f, GFoldMapNonSum Builder f, asserts ~ '['NoEmpty, 'NoSum], ApplyGCAsserts asserts f) => a -> Builder 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 Builder f, asserts ~ '['NoEmpty, 'NeedSum], ApplyGCAsserts asserts f) => (String -> Builder) -> a -> Builder Source #
class PutWith r a where Source #
Put with inlined checks via an environment.
Nothing
putWithout :: Put a => a -> Either String Builder Source #
Helper for wrapping a BinRep
into a BinRepWith
(for encoding).
runPutWith :: PutWith r a => r -> a -> Either String ByteString Source #
Run the serializer with the given environment.
Orphan instances
GenericFoldMap Builder Source # | |
type GenericFoldMapC Builder a # genericFoldMapF :: GenericFoldMapC Builder a => a -> Builder # |