Safe Haskell | None |
---|---|
Language | Haskell2010 |
Cardano.Api.Serialise.DeserialiseAnyOf
Description
Class of errors used in the Api.
Synopsis
- data InputFormat a where
- InputFormatBech32 :: forall a. SerialiseAsBech32 a => InputFormat a
- InputFormatHex :: forall a. SerialiseAsRawBytes a => InputFormat a
- InputFormatTextEnvelope :: forall a. HasTextEnvelope a => InputFormat a
- data InputDecodeError
- deserialiseInput :: NonEmpty (InputFormat a) -> ByteString -> Either InputDecodeError a
- deserialiseInputAnyOf :: [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> ByteString -> Either InputDecodeError b
- readFormattedFile :: NonEmpty (InputFormat a) -> FilePath -> IO (Either (FileError InputDecodeError) a)
- readFormattedFileTextEnvelope :: HasTextEnvelope a => File content 'In -> IO (Either (FileError InputDecodeError) a)
- readFormattedFileAnyOf :: forall content b. [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> File content 'In -> IO (Either (FileError InputDecodeError) b)
- renderInputDecodeError :: InputDecodeError -> Doc ann
Documentation
data InputFormat a where Source #
Input format/encoding.
Constructors
InputFormatBech32 :: forall a. SerialiseAsBech32 a => InputFormat a | Bech32 encoding. |
InputFormatHex :: forall a. SerialiseAsRawBytes a => InputFormat a | Hex/Base16 encoding. |
InputFormatTextEnvelope :: forall a. HasTextEnvelope a => InputFormat a | Text envelope format. |
data InputDecodeError Source #
Input decoding error.
Constructors
InputTextEnvelopeError !TextEnvelopeError | The provided data seems to be a valid text envelope, but some error occurred in deserialising it. |
InputBech32DecodeError !Bech32DecodeError | The provided data is valid Bech32, but some error occurred in deserialising it. |
InputInvalidError | The provided data does not represent a valid value of the provided type. |
Instances
deserialiseInput :: NonEmpty (InputFormat a) -> ByteString -> Either InputDecodeError a Source #
Deserialise an input of some type that is formatted in some way.
deserialiseInputAnyOf :: [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> ByteString -> Either InputDecodeError b Source #
Deserialise an input of some type that is formatted in some way.
The provided ByteString
can either be Bech32-encoded or in the text
envelope format.
Arguments
:: NonEmpty (InputFormat a) | one of expected input formats |
-> FilePath | |
-> IO (Either (FileError InputDecodeError) a) |
Read formatted file
readFormattedFileTextEnvelope :: HasTextEnvelope a => File content 'In -> IO (Either (FileError InputDecodeError) a) Source #
Read text envelope file
readFormattedFileAnyOf :: forall content b. [FromSomeType SerialiseAsBech32 b] -> [FromSomeType HasTextEnvelope b] -> File content 'In -> IO (Either (FileError InputDecodeError) b) Source #
Read in in any of the format in the text envelope
renderInputDecodeError :: InputDecodeError -> Doc ann Source #
Render an error message for a InputDecodeError
.