Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- module Network.TypedProtocol.Codec
- mkCodecCborLazyBS :: forall ps (m :: Type -> Type). MonadST m => (forall (st :: ps) (st' :: ps). (StateTokenI st, ActiveState st) => Message ps st st' -> Encoding) -> (forall (st :: ps) s. ActiveState st => StateToken st -> Decoder s (SomeMessage st)) -> Codec ps DeserialiseFailure m ByteString
- mkCodecCborStrictBS :: forall ps (m :: Type -> Type). MonadST m => (forall (st :: ps) (st' :: ps). (StateTokenI st, ActiveState st) => Message ps st st' -> Encoding) -> (forall (st :: ps) s. ActiveState st => StateToken st -> Decoder s (SomeMessage st)) -> Codec ps DeserialiseFailure m ByteString
- convertCborDecoderBS :: forall s m a. Functor m => Decoder s a -> (forall b. ST s b -> m b) -> m (DecodeStep ByteString DeserialiseFailure m a)
- convertCborDecoderLBS :: forall s m a. Monad m => Decoder s a -> (forall b. ST s b -> m b) -> m (DecodeStep ByteString DeserialiseFailure m a)
- data DeserialiseFailure = DeserialiseFailure ByteOffset String
Documentation
module Network.TypedProtocol.Codec
:: forall ps (m :: Type -> Type). MonadST m | |
=> (forall (st :: ps) (st' :: ps). (StateTokenI st, ActiveState st) => Message ps st st' -> Encoding) | cbor encoder |
-> (forall (st :: ps) s. ActiveState st => StateToken st -> Decoder s (SomeMessage st)) | cbor decoder |
-> Codec ps DeserialiseFailure m ByteString |
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.
:: forall ps (m :: Type -> Type). MonadST m | |
=> (forall (st :: ps) (st' :: ps). (StateTokenI st, ActiveState st) => Message ps st st' -> Encoding) | cbor encoder |
-> (forall (st :: ps) s. ActiveState st => StateToken st -> Decoder s (SomeMessage st)) | cbor decoder |
-> Codec ps DeserialiseFailure m ByteString |
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).
:: forall s m a. Functor m | |
=> Decoder s a | cbor decoder |
-> (forall b. ST s b -> m b) | lift ST computation (e.g. |
-> m (DecodeStep ByteString DeserialiseFailure m a) |
convertCborDecoderLBS Source #
:: forall s m a. Monad m | |
=> Decoder s a | cbor decoder |
-> (forall b. ST s b -> m b) | lift ST computation (e.g. |
-> m (DecodeStep ByteString DeserialiseFailure m a) |
Re-exports
data DeserialiseFailure #
An exception type that may be returned (by pure functions) or thrown (by IO actions) that fail to deserialise a given input.
Since: cborg-0.2.0.0
Instances
NFData DeserialiseFailure | |
Defined in Codec.CBOR.Read rnf :: DeserialiseFailure -> () # | |
Exception DeserialiseFailure | |
Defined in Codec.CBOR.Read | |
Show DeserialiseFailure | |
Defined in Codec.CBOR.Read showsPrec :: Int -> DeserialiseFailure -> ShowS # show :: DeserialiseFailure -> String # showList :: [DeserialiseFailure] -> ShowS # | |
Eq DeserialiseFailure | |
Defined in Codec.CBOR.Read (==) :: DeserialiseFailure -> DeserialiseFailure -> Bool # (/=) :: DeserialiseFailure -> DeserialiseFailure -> Bool # |