typed-encoding-0.5.2.2: Type safe string transformations

Safe HaskellSafe
LanguageHaskell2010

Data.TypedEncoding.Common.Class.Decode

Description

Type classes accompanying decoding types defined in Data.TypedEncoding.Common.Types.Decoding

Examples.TypedEncoding.Instances.DiySignEncoding contains an implementation example.

Examples.TypedEncoding.Overview shows decoding usage examples.

This module is re-exported in Data.TypedEncoding and it is best not to import it directly.

Synopsis

Documentation

class Decode f nm alg conf str where Source #

Since: 0.3.0.0

Methods

decoding :: Decoding f nm alg conf str Source #

Instances
Applicative f => Decode f "r-UTF8" "r-UTF8" c str Source # 
Instance details

Defined in Data.TypedEncoding.Instances.Restriction.UTF8

Methods

decoding :: Decoding f "r-UTF8" "r-UTF8" c str Source #

Applicative f => Decode f "r-Int-decimal" "r-Int-decimal" c str Source # 
Instance details

Defined in Data.TypedEncoding.Instances.Restriction.Misc

Methods

decoding :: Decoding f "r-Int-decimal" "r-Int-decimal" c str Source #

Applicative f => Decode f "r-Word8-decimal" "r-Word8-decimal" c str Source # 
Instance details

Defined in Data.TypedEncoding.Instances.Restriction.Misc

Methods

decoding :: Decoding f "r-Word8-decimal" "r-Word8-decimal" c str Source #

(KnownSymbol s, Restriction s, Algorithm s "r-ban", Applicative f) => Decode f s "r-ban" c str Source # 
Instance details

Defined in Data.TypedEncoding.Instances.Restriction.BoundedAlphaNums

Methods

decoding :: Decoding f s "r-ban" c str Source #

(UnexpectedDecodeErr f, Applicative f) => Decode f "enc-B64" "enc-B64" c Text Source #

Since: 0.3.0.0

Instance details

Defined in Data.TypedEncoding.Instances.Enc.Warn.Base64

Methods

decoding :: Decoding f "enc-B64" "enc-B64" c Text Source #

(UnexpectedDecodeErr f, Applicative f) => Decode f "enc-B64" "enc-B64" c Text Source #

Since: 0.3.0.0

Instance details

Defined in Data.TypedEncoding.Instances.Enc.Warn.Base64

Methods

decoding :: Decoding f "enc-B64" "enc-B64" c Text Source #

Applicative f => Decode f "r-UNICODE.D76" "r-UNICODE.D76" c str Source # 
Instance details

Defined in Data.TypedEncoding.Instances.Restriction.D76

Methods

decoding :: Decoding f "r-UNICODE.D76" "r-UNICODE.D76" c str Source #

Applicative f => Decode f "r-ASCII" "r-ASCII" c str Source # 
Instance details

Defined in Data.TypedEncoding.Instances.Restriction.ASCII

Methods

decoding :: Decoding f "r-ASCII" "r-ASCII" c str Source #

Applicative f => Decode f "r-B64" "r-B64" c str Source # 
Instance details

Defined in Data.TypedEncoding.Instances.Restriction.Base64

Methods

decoding :: Decoding f "r-B64" "r-B64" c str Source #

(UnexpectedDecodeErr f, Applicative f) => Decode f "enc-B64" "enc-B64" c ByteString Source #

Since: 0.3.0.0

Instance details

Defined in Data.TypedEncoding.Instances.Enc.Base64

Methods

decoding :: Decoding f "enc-B64" "enc-B64" c ByteString Source #

(UnexpectedDecodeErr f, Applicative f) => Decode f "enc-B64" "enc-B64" c ByteString Source #

Since: 0.3.0.0

Instance details

Defined in Data.TypedEncoding.Instances.Enc.Base64

Methods

decoding :: Decoding f "enc-B64" "enc-B64" c ByteString Source #

(UnexpectedDecodeErr f, Applicative f) => Decode f "my-sign" "my-sign" c Text Source #

Decoding allows effectful f to allow for troubleshooting and unsafe payload changes.

Implementation simply uses implDecodingF combinator on the asUnexpected composed with decoding function.

UnexpectedDecodeErr has Identity instance allowing for decoding that assumes errors are not possible.

For debugging purposes or when unsafe changes to "my-sign" Error UnexpectedDecodeEx instance can be used.

Instance details

Defined in Examples.TypedEncoding.Instances.DiySignEncoding

Methods

decoding :: Decoding f "my-sign" "my-sign" c Text Source #

class DecodeAll f nms algs conf str where Source #

Since: 0.3.0.0

Methods

decodings :: Decodings f nms algs conf str Source #

Instances
DecodeAll f ([] :: [Symbol]) ([] :: [Symbol]) conf str Source # 
Instance details

Defined in Data.TypedEncoding.Common.Class.Decode

Methods

decodings :: Decodings f [] [] conf str Source #

(DecodeAll f nms algs conf str, Decode f nm alg conf str) => DecodeAll f (nm ': nms) (alg ': algs) conf str Source # 
Instance details

Defined in Data.TypedEncoding.Common.Class.Decode

Methods

decodings :: Decodings f (nm ': nms) (alg ': algs) conf str Source #

class UnexpectedDecodeErr f where Source #

With type safety in place decoding errors should be unexpected. This class can be used to provide extra info if decoding could fail

Since: 0.1.0.0

asUnexpected_ :: (KnownSymbol x, UnexpectedDecodeErr f, Applicative f, Show err) => Proxy x -> Either err a -> f a Source #

Since: 0.1.0.0

asUnexpected :: forall x f err a. (KnownSymbol x, UnexpectedDecodeErr f, Applicative f, Show err) => Either err a -> f a Source #

Since: 0.1.0.0