Safe Haskell | None |
---|---|
Language | Haskell2010 |
TextEnvelope Serialisation
Synopsis
- class SerialiseAsCBOR a => HasTextEnvelope a where
- textEnvelopeTypeInEra :: HasTextEnvelope (f era) => CardanoEra era -> AsType (f era) -> TextEnvelopeType
- data TextEnvelope = TextEnvelope {}
- newtype TextEnvelopeType = TextEnvelopeType String
- newtype TextEnvelopeDescr = TextEnvelopeDescr String
- textEnvelopeRawCBOR :: TextEnvelope -> ByteString
- data TextEnvelopeError
- serialiseToTextEnvelope :: HasTextEnvelope a => Maybe TextEnvelopeDescr -> a -> TextEnvelope
- deserialiseFromTextEnvelope :: HasTextEnvelope a => AsType a -> TextEnvelope -> Either TextEnvelopeError a
- readFileTextEnvelope :: HasTextEnvelope a => AsType a -> File content 'In -> IO (Either (FileError TextEnvelopeError) a)
- writeFileTextEnvelope :: HasTextEnvelope a => File content 'Out -> Maybe TextEnvelopeDescr -> a -> IO (Either (FileError ()) ())
- readTextEnvelopeFromFile :: FilePath -> IO (Either (FileError TextEnvelopeError) TextEnvelope)
- readTextEnvelopeOfTypeFromFile :: TextEnvelopeType -> FilePath -> IO (Either (FileError TextEnvelopeError) TextEnvelope)
- textEnvelopeToJSON :: HasTextEnvelope a => Maybe TextEnvelopeDescr -> a -> ByteString
- legacyComparison :: TextEnvelopeType -> TextEnvelopeType -> Bool
- data FromSomeType (c :: Type -> Constraint) b where
- FromSomeType :: forall (c :: Type -> Constraint) a b. c a => AsType a -> (a -> b) -> FromSomeType c b
- deserialiseFromTextEnvelopeAnyOf :: [FromSomeType HasTextEnvelope b] -> TextEnvelope -> Either TextEnvelopeError b
- readFileTextEnvelopeAnyOf :: [FromSomeType HasTextEnvelope b] -> File content 'In -> IO (Either (FileError TextEnvelopeError) b)
- data family AsType t
Documentation
class SerialiseAsCBOR a => HasTextEnvelope a where Source #
textEnvelopeType :: AsType a -> TextEnvelopeType Source #
Instances
textEnvelopeTypeInEra :: HasTextEnvelope (f era) => CardanoEra era -> AsType (f era) -> TextEnvelopeType Source #
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. "PublicKeyByron" or "TxSignedShelley" 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
FromJSON TextEnvelope Source # | |||||
Defined in Cardano.Api.SerialiseTextEnvelope parseJSON :: Value -> Parser TextEnvelope # parseJSONList :: Value -> Parser [TextEnvelope] # | |||||
ToJSON TextEnvelope Source # | |||||
Defined in Cardano.Api.SerialiseTextEnvelope toJSON :: TextEnvelope -> Value # toEncoding :: TextEnvelope -> Encoding # toJSONList :: [TextEnvelope] -> Value # toEncodingList :: [TextEnvelope] -> Encoding # omitField :: TextEnvelope -> Bool # | |||||
Show TextEnvelope Source # | |||||
Defined in Cardano.Api.SerialiseTextEnvelope | |||||
HasTypeProxy TextEnvelope Source # | |||||
Defined in Cardano.Api.SerialiseTextEnvelope
| |||||
Eq TextEnvelope Source # | |||||
Defined in Cardano.Api.SerialiseTextEnvelope (==) :: TextEnvelope -> TextEnvelope -> Bool Source # (/=) :: TextEnvelope -> TextEnvelope -> Bool Source # | |||||
data AsType TextEnvelope Source # | |||||
Defined in Cardano.Api.SerialiseTextEnvelope |
newtype TextEnvelopeType Source #
Instances
newtype TextEnvelopeDescr Source #
Instances
data TextEnvelopeError Source #
The errors that the pure TextEnvelope
parsing/decoding functions can return.
TextEnvelopeTypeError ![TextEnvelopeType] !TextEnvelopeType | expected, actual |
TextEnvelopeDecodeError !DecoderError | |
TextEnvelopeAesonDecodeError !String |
Instances
serialiseToTextEnvelope :: HasTextEnvelope a => Maybe TextEnvelopeDescr -> a -> TextEnvelope Source #
deserialiseFromTextEnvelope :: HasTextEnvelope a => AsType a -> TextEnvelope -> Either TextEnvelopeError a Source #
readFileTextEnvelope :: HasTextEnvelope a => AsType a -> File content 'In -> IO (Either (FileError TextEnvelopeError) a) Source #
writeFileTextEnvelope :: HasTextEnvelope a => File content 'Out -> Maybe TextEnvelopeDescr -> a -> IO (Either (FileError ()) ()) Source #
readTextEnvelopeFromFile :: FilePath -> IO (Either (FileError TextEnvelopeError) TextEnvelope) Source #
readTextEnvelopeOfTypeFromFile :: TextEnvelopeType -> FilePath -> IO (Either (FileError TextEnvelopeError) TextEnvelope) Source #
textEnvelopeToJSON :: HasTextEnvelope a => Maybe TextEnvelopeDescr -> a -> ByteString Source #
legacyComparison :: TextEnvelopeType -> TextEnvelopeType -> Bool Source #
This is a backwards-compatibility patch to ensure that old envelopes
generated by serialiseTxLedgerCddl
can be deserialised after switching
to the serialiseToTextEnvelope
.
Reading one of several key types
data FromSomeType (c :: Type -> Constraint) b where Source #
FromSomeType :: forall (c :: Type -> Constraint) a b. c a => AsType a -> (a -> b) -> FromSomeType c b |
deserialiseFromTextEnvelopeAnyOf :: [FromSomeType HasTextEnvelope b] -> TextEnvelope -> Either TextEnvelopeError b Source #
readFileTextEnvelopeAnyOf :: [FromSomeType HasTextEnvelope b] -> File content 'In -> 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.