Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Network.TypedProtocol.Codec.CBOR
Synopsis
- module Network.TypedProtocol.Codec
- type DeserialiseFailure = DeserialiseFailure
- mkCodecCborLazyBS :: forall ps m. MonadST m => (forall (pr :: PeerRole) (st :: ps) (st' :: ps). PeerHasAgency pr st -> Message ps st st' -> Encoding) -> (forall (pr :: PeerRole) (st :: ps) s. PeerHasAgency pr st -> Decoder s (SomeMessage st)) -> Codec ps DeserialiseFailure m ByteString
- mkCodecCborStrictBS :: forall ps m. MonadST m => (forall (pr :: PeerRole) (st :: ps) (st' :: ps). PeerHasAgency pr st -> Message ps st st' -> Encoding) -> (forall (pr :: PeerRole) (st :: ps) s. PeerHasAgency pr st -> Decoder s (SomeMessage st)) -> Codec ps DeserialiseFailure m ByteString
Documentation
module Network.TypedProtocol.Codec
mkCodecCborLazyBS :: forall ps m. MonadST m => (forall (pr :: PeerRole) (st :: ps) (st' :: ps). PeerHasAgency pr st -> Message ps st st' -> Encoding) -> (forall (pr :: PeerRole) (st :: ps) s. PeerHasAgency pr st -> Decoder s (SomeMessage st)) -> Codec ps DeserialiseFailure m ByteString Source #
Construct a Codec
for a CBOR based serialisation format, using lazy
ByteString
s.
This is an adaptor between the cborg
library and the Codec
abstraction.
It takes encode and decode functions for the protocol messages that use the CBOR library encoder and decoder.
mkCodecCborStrictBS :: forall ps m. MonadST m => (forall (pr :: PeerRole) (st :: ps) (st' :: ps). PeerHasAgency pr st -> Message ps st st' -> Encoding) -> (forall (pr :: PeerRole) (st :: ps) s. PeerHasAgency pr st -> Decoder s (SomeMessage st)) -> Codec ps DeserialiseFailure m ByteString Source #
Construct a Codec
for a CBOR based serialisation format, using strict
ByteString
s.
This is an adaptor between the cborg
library and the Codec
abstraction.
It takes encode and decode functions for the protocol messages that use the CBOR library encoder and decoder.
Note that this is less efficient than the mkCodecCborLazyBS
variant
because it has to copy and concatenate the result of the encoder (which
natively produces chunks).