Safe Haskell | None |
---|---|
Language | Haskell2010 |
TextEnvelope Serialisation
Synopsis
- class SerialiseAsCBOR a ⇒ HasTextEnvelope a where
- data TextEnvelope = TextEnvelope {}
- newtype TextEnvelopeType = TextEnvelopeType String
- newtype TextEnvelopeDescr = TextEnvelopeDescr String
- textEnvelopeRawCBOR ∷ TextEnvelope → ByteString
- data TextEnvelopeError
- = TextEnvelopeTypeError ![TextEnvelopeType] !TextEnvelopeType
- | TextEnvelopeDecodeError !DecoderError
- | TextEnvelopeAesonDecodeError !String
- serialiseToTextEnvelope ∷ ∀ a. HasTextEnvelope a ⇒ Maybe TextEnvelopeDescr → a → TextEnvelope
- deserialiseFromTextEnvelope ∷ HasTextEnvelope a ⇒ AsType a → TextEnvelope → Either TextEnvelopeError a
- readFileTextEnvelope ∷ HasTextEnvelope a ⇒ AsType a → FilePath → IO (Either (FileError TextEnvelopeError) a)
- writeFileTextEnvelope ∷ HasTextEnvelope a ⇒ FilePath → Maybe TextEnvelopeDescr → a → IO (Either (FileError ()) ())
- writeFileTextEnvelopeWithOwnerPermissions ∷ HasTextEnvelope a ⇒ FilePath → Maybe TextEnvelopeDescr → a → IO (Either (FileError ()) ())
- readTextEnvelopeFromFile ∷ FilePath → IO (Either (FileError TextEnvelopeError) TextEnvelope)
- readTextEnvelopeOfTypeFromFile ∷ TextEnvelopeType → FilePath → IO (Either (FileError TextEnvelopeError) TextEnvelope)
- data FromSomeType (c ∷ Type → Constraint) b where
- FromSomeType ∷ c a ⇒ AsType a → (a → b) → FromSomeType c b
- deserialiseFromTextEnvelopeAnyOf ∷ [FromSomeType HasTextEnvelope b] → TextEnvelope → Either TextEnvelopeError b
- readFileTextEnvelopeAnyOf ∷ [FromSomeType HasTextEnvelope b] → FilePath → IO (Either (FileError TextEnvelopeError) b)
- data family AsType t
Documentation
class SerialiseAsCBOR a ⇒ HasTextEnvelope a where Source #
Instances
data TextEnvelope Source #
A TextEnvelope
is a structured envelope for serialised binary values
with an external format with a semi-readable textual format.
It contains a "type" field, e.g. "PublicKeyCole" or "TxSignedSophie" to indicate the type of the encoded data. This is used as a sanity check and to help readers.
It also contains a "title" field which is free-form, and could be used to indicate the role or purpose to a reader.
Instances
Eq TextEnvelope Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope (==) ∷ TextEnvelope → TextEnvelope → Bool Source # (/=) ∷ TextEnvelope → TextEnvelope → Bool Source # | |
Show TextEnvelope Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope | |
FromJSON TextEnvelope Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope parseJSON ∷ Value → Parser TextEnvelope # parseJSONList ∷ Value → Parser [TextEnvelope] # | |
ToJSON TextEnvelope Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope toJSON ∷ TextEnvelope → Value # toEncoding ∷ TextEnvelope → Encoding # toJSONList ∷ [TextEnvelope] → Value # toEncodingList ∷ [TextEnvelope] → Encoding # | |
HasTypeProxy TextEnvelope Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope data AsType TextEnvelope Source # | |
data AsType TextEnvelope Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope |
newtype TextEnvelopeType Source #
Instances
Eq TextEnvelopeType Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope | |
Show TextEnvelopeType Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope | |
IsString TextEnvelopeType Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope | |
Semigroup TextEnvelopeType Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope | |
FromJSON TextEnvelopeType Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope parseJSON ∷ Value → Parser TextEnvelopeType # parseJSONList ∷ Value → Parser [TextEnvelopeType] # | |
ToJSON TextEnvelopeType Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope toJSON ∷ TextEnvelopeType → Value # toEncoding ∷ TextEnvelopeType → Encoding # toJSONList ∷ [TextEnvelopeType] → Value # toEncodingList ∷ [TextEnvelopeType] → Encoding # |
newtype TextEnvelopeDescr Source #
Instances
Eq TextEnvelopeDescr Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope | |
Show TextEnvelopeDescr Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope | |
IsString TextEnvelopeDescr Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope | |
Semigroup TextEnvelopeDescr Source # | |
FromJSON TextEnvelopeDescr Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope parseJSON ∷ Value → Parser TextEnvelopeDescr # parseJSONList ∷ Value → Parser [TextEnvelopeDescr] # | |
ToJSON TextEnvelopeDescr Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope toJSON ∷ TextEnvelopeDescr → Value # toEncoding ∷ TextEnvelopeDescr → Encoding # toJSONList ∷ [TextEnvelopeDescr] → Value # toEncodingList ∷ [TextEnvelopeDescr] → Encoding # |
data TextEnvelopeError Source #
The errors that the pure TextEnvelope
parsing/decoding functions can return.
TextEnvelopeTypeError ![TextEnvelopeType] !TextEnvelopeType | expected, actual |
TextEnvelopeDecodeError !DecoderError | |
TextEnvelopeAesonDecodeError !String |
Instances
Eq TextEnvelopeError Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope | |
Show TextEnvelopeError Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope | |
Error TextEnvelopeError Source # | |
Defined in Bcc.Api.SerialiseTextEnvelope |
serialiseToTextEnvelope ∷ ∀ a. HasTextEnvelope a ⇒ Maybe TextEnvelopeDescr → a → TextEnvelope Source #
deserialiseFromTextEnvelope ∷ HasTextEnvelope a ⇒ AsType a → TextEnvelope → Either TextEnvelopeError a Source #
readFileTextEnvelope ∷ HasTextEnvelope a ⇒ AsType a → FilePath → IO (Either (FileError TextEnvelopeError) a) Source #
writeFileTextEnvelope ∷ HasTextEnvelope a ⇒ FilePath → Maybe TextEnvelopeDescr → a → IO (Either (FileError ()) ()) Source #
writeFileTextEnvelopeWithOwnerPermissions ∷ HasTextEnvelope a ⇒ FilePath → Maybe TextEnvelopeDescr → a → IO (Either (FileError ()) ()) Source #
readTextEnvelopeFromFile ∷ FilePath → IO (Either (FileError TextEnvelopeError) TextEnvelope) Source #
readTextEnvelopeOfTypeFromFile ∷ TextEnvelopeType → FilePath → IO (Either (FileError TextEnvelopeError) TextEnvelope) Source #
Reading one of several key types
data FromSomeType (c ∷ Type → Constraint) b where Source #
FromSomeType ∷ c a ⇒ AsType a → (a → b) → FromSomeType c b |
deserialiseFromTextEnvelopeAnyOf ∷ [FromSomeType HasTextEnvelope b] → TextEnvelope → Either TextEnvelopeError b Source #
readFileTextEnvelopeAnyOf ∷ [FromSomeType HasTextEnvelope b] → FilePath → IO (Either (FileError TextEnvelopeError) b) Source #
Data family instances
A family of singleton types used in this API to indicate which type to use where it would otherwise be ambiguous or merely unclear.
Values of this type are passed to deserialisation functions for example.