Module

Data.Codec

Package
purescript-codec
Repository
garyb/purescript-codec

#Codec Source

data Codec :: (Type -> Type) -> Type -> Type -> Type -> Type -> Typedata Codec m a b c d

Constructors

Instances

#codec Source

codec :: forall m a b c. (a -> m c) -> (c -> b) -> Codec m a b c c

#Codec' Source

type Codec' :: (Type -> Type) -> Type -> Type -> Typetype Codec' m a b = Codec m a a b b

#codec' Source

codec' :: forall m a b. (a -> m b) -> (b -> a) -> Codec' m a b

#decode Source

decode :: forall m a b c d. Codec m a b c d -> a -> m d

#encode Source

encode :: forall m a b c d. Codec m a b c d -> c -> b

#hoist Source

hoist :: forall m m' a b c d. (m ~> m') -> Codec m a b c d -> Codec m' a b c d

#identity Source

identity :: forall m a. Applicative m => Codec m a a a a

#compose Source

compose :: forall a d f b e c m. Bind m => Codec m d c e f -> Codec m a b c d -> Codec m a b e f

#(<~<) Source

Operator alias for Data.Codec.compose (right-associative / precedence 8)

#composeFlipped Source

composeFlipped :: forall a d f b e c m. Bind m => Codec m a b c d -> Codec m d c e f -> Codec m a b e f

#(>~>) Source

Operator alias for Data.Codec.composeFlipped (right-associative / precedence 8)

#(~) Source

Operator alias for Data.Profunctor.lcmap (left-associative / precedence 5)

Codec is defined as a Profunctor so that lcmap can be used to target specific fields when defining a codec for a product type. This operator is a convenience for that:

tupleCodec =
  Tuple
    <$> fst ~ fstCodec
    <*> snd ~ sndCodec
Modules
Data.Codec