| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Versioning.Internal.Decoding
Description
Encoding-agnosting deserialization utilities.
- type family Applied (c :: Type -> Constraint) (a :: V -> Type) :: Type
- type Apply a c = forall v. c (a v) => a v -> Applied c a
- type ApplyM m a c = forall v. c (a v) => a v -> m (Applied c a)
- type DecodableTo dec v a = DecodeAnyVersion v v a dec
- class DecodeAnyVersion (v :: V) (w :: V) (a :: V -> Type) dec
- newtype Decoder dec enc t a = Decoder (forall v. dec (a v) => enc -> t (a v))
- class WithAnyVersion (v :: V) (a :: V -> Type) c dec
- decodeAnyVersion :: forall v a dec enc t. (Alt t, Applicative t, DecodableTo dec v a) => Decoder dec enc t a -> enc -> t (a v)
- withAnyVersion :: forall v c a dec enc t. (WithAnyVersion v a c dec, c (a v), Alt t, Applicative t, Traversable t) => Decoder dec enc t a -> Apply a c -> enc -> t (Applied c a)
- withAnyVersionM :: forall v c a dec enc m t. (WithAnyVersion v a c dec, Alt t, Applicative t, Traversable t, Applicative m, c (a v)) => Decoder dec enc t a -> ApplyM m a c -> enc -> m (t (Applied c a))
Documentation
type family Applied (c :: Type -> Constraint) (a :: V -> Type) :: Type Source #
The result type of the action that has been applied to the decoded object
with withAnyVersion or withAnyVersionM.
type Apply a c = forall v. c (a v) => a v -> Applied c a Source #
The pure function to apply to the decoded object with withAnyVersion
type ApplyM m a c = forall v. c (a v) => a v -> m (Applied c a) Source #
The action to apply to the decoded object with withAnyVersionM
type DecodableTo dec v a = DecodeAnyVersion v v a dec Source #
Handy constraint synonym to be used with decodeAnyVersion
class DecodeAnyVersion (v :: V) (w :: V) (a :: V -> Type) dec Source #
Minimal complete definition
decodeAnyVersion'
newtype Decoder dec enc t a Source #
The function that will perform the actual decoding
Constructors
| Decoder (forall v. dec (a v) => enc -> t (a v)) |
class WithAnyVersion (v :: V) (a :: V -> Type) c dec Source #
Minimal complete definition
withAnyVersion'
decodeAnyVersion :: forall v a dec enc t. (Alt t, Applicative t, DecodableTo dec v a) => Decoder dec enc t a -> enc -> t (a v) Source #
Decode by trying all the versions decrementally and upgrade the decoded object to the newest version.
withAnyVersion :: forall v c a dec enc t. (WithAnyVersion v a c dec, c (a v), Alt t, Applicative t, Traversable t) => Decoder dec enc t a -> Apply a c -> enc -> t (Applied c a) Source #
Pure version of withAnyVersionM.
withAnyVersionM :: forall v c a dec enc m t. (WithAnyVersion v a c dec, Alt t, Applicative t, Traversable t, Applicative m, c (a v)) => Decoder dec enc t a -> ApplyM m a c -> enc -> m (t (Applied c a)) Source #
Decode by trying all the versions decrementally and apply an action to the decoded object at its original version.