codec-0.2: Simple bidirectional serialization
Control.Monad.Codec
Synopsis
data CodecFor r w c a Source #
A serializer/deserializer pair reading a in context r and writing c in context w.
a
r
c
w
Constructors
Fields
Instances
Methods
dimap :: (a -> b) -> (c -> d) -> CodecFor r w b c -> CodecFor r w a d #
lmap :: (a -> b) -> CodecFor r w b c -> CodecFor r w a c #
rmap :: (b -> c) -> CodecFor r w a b -> CodecFor r w a c #
(#.) :: Coercible * c b => (b -> c) -> CodecFor r w a b -> CodecFor r w a c #
(.#) :: Coercible * b a => CodecFor r w b c -> (a -> b) -> CodecFor r w a c #
(>>=) :: CodecFor r w c a -> (a -> CodecFor r w c b) -> CodecFor r w c b #
(>>) :: CodecFor r w c a -> CodecFor r w c b -> CodecFor r w c b #
return :: a -> CodecFor r w c a #
fail :: String -> CodecFor r w c a #
fmap :: (a -> b) -> CodecFor r w c a -> CodecFor r w c b #
(<$) :: a -> CodecFor r w c b -> CodecFor r w c a #
pure :: a -> CodecFor r w c a #
(<*>) :: CodecFor r w c (a -> b) -> CodecFor r w c a -> CodecFor r w c b #
(*>) :: CodecFor r w c a -> CodecFor r w c b -> CodecFor r w c b #
(<*) :: CodecFor r w c a -> CodecFor r w c b -> CodecFor r w c a #
type Codec r w a = CodecFor r w a a Source #
(=.) :: (c' -> c) -> CodecFor r w c a -> CodecFor r w c' a Source #
Compose a function into the serializer of a Codec. Useful to modify a Codec so that it writes a particular record field.
Codec
fmapArg :: Functor f => (a -> f ()) -> a -> f a Source #
Modify a serializer function so that it also returns the serialized value, Useful for implementing codecs.