| Safe Haskell | Safe-Inferred | 
|---|---|
| Language | Haskell2010 | 
Unison.Util.Servant.CBOR
Description
Servant configuration for the CBOR media type
Adapted from https://hackage.haskell.org/package/servant-serialization-0.3/docs/Servant-API-ContentTypes-SerialiseCBOR.html via MIT license
Synopsis
- data CBOR
- type UnknownCBORBytes = CBORBytes Unknown
- newtype CBORBytes t = CBORBytes ByteString
- newtype CBORStream a = CBORStream ByteString
- deserialiseOrFailCBORBytes :: Serialise t => CBORBytes t -> Either DeserialiseFailure t
- serialiseCBORBytes :: Serialise t => t -> CBORBytes t
- decodeCBORBytes :: Serialise t => CBORBytes t -> Decoder s t
- decodeUnknownCBORBytes :: Serialise t => UnknownCBORBytes -> Decoder s t
- serialiseUnknownCBORBytes :: Serialise t => t -> UnknownCBORBytes
Documentation
Content-type for encoding and decoding objects as their CBOR representations
Instances
| Accept CBOR Source # | Mime-type for CBOR and additional ones using the word "hackage" and the name of the package "serialise". | 
| Defined in Unison.Util.Servant.CBOR | |
| Serialise a => MimeRender CBOR a Source # | 
 | 
| Defined in Unison.Util.Servant.CBOR Methods mimeRender :: Proxy CBOR -> a -> ByteString # | |
| Serialise a => MimeUnrender CBOR a Source # | 
 
 
 | 
| Defined in Unison.Util.Servant.CBOR Methods mimeUnrender :: Proxy CBOR -> ByteString -> Either String a # mimeUnrenderWithType :: Proxy CBOR -> MediaType -> ByteString -> Either String a # | |
type UnknownCBORBytes = CBORBytes Unknown Source #
Wrapper for CBOR data that has already been serialized. In our case, we use this because we may load pre-serialized CBOR directly from the database, but it's also useful in allowing us to more quickly seek through a CBOR stream, since we only need to decode the CBOR when/if we actually need to use it, and can skip past it using a byte offset otherwise.
The t phantom type is the type of the data encoded in the bytestring.
Constructors
| CBORBytes ByteString | 
Instances
| Show (CBORBytes t) Source # | |
| Eq (CBORBytes t) Source # | |
| Ord (CBORBytes t) Source # | |
| Defined in Unison.Util.Servant.CBOR | |
| Serialise (CBORBytes t) Source # | |
newtype CBORStream a Source #
Wrapper for a stream of CBOR data. Each chunk may not be a complete CBOR value, but the concatenation of all the chunks is a valid CBOR stream.
Constructors
| CBORStream ByteString | 
Instances
deserialiseOrFailCBORBytes :: Serialise t => CBORBytes t -> Either DeserialiseFailure t Source #
Deserialize a CBORBytes value into its tagged type, throwing an error if the deserialization fails.
serialiseCBORBytes :: Serialise t => t -> CBORBytes t Source #
decodeUnknownCBORBytes :: Serialise t => UnknownCBORBytes -> Decoder s t Source #
serialiseUnknownCBORBytes :: Serialise t => t -> UnknownCBORBytes Source #