Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Argo.Type.Codec
Documentation
decodeWith :: ValueCodec a -> Value -> Either String a Source #
encodeWith :: ValueCodec a -> a -> Value Source #
Instances
(Functor r, Functor w) => Functor (CodecOf r w i) Source # | |
(Applicative r, Applicative w) => Applicative (CodecOf r w i) Source # | |
Defined in Argo.Type.Codec Methods pure :: a -> CodecOf r w i a # (<*>) :: CodecOf r w i (a -> b) -> CodecOf r w i a -> CodecOf r w i b # liftA2 :: (a -> b -> c) -> CodecOf r w i a -> CodecOf r w i b -> CodecOf r w i c # (*>) :: CodecOf r w i a -> CodecOf r w i b -> CodecOf r w i b # (<*) :: CodecOf r w i a -> CodecOf r w i b -> CodecOf r w i a # | |
(Alternative r, Alternative w) => Alternative (CodecOf r w i) Source # | |
type ValueCodec a = Codec (ReaderT Value (ExceptT String Identity)) (MaybeT (StateT Value Identity)) a Source #
arrayCodec :: ValueCodec (ArrayOf Value) Source #
mapMaybe :: (Alternative r, Alternative w, Monad r, Monad w) => (o2 -> Maybe o1) -> (i1 -> Maybe i2) -> CodecOf r w i2 o2 -> CodecOf r w i1 o1 Source #
toAlternative :: Alternative m => Maybe a -> m a Source #
tagged :: String -> ValueCodec a -> ValueCodec a Source #
literalCodec :: Value -> ValueCodec () Source #
fromListCodec :: ValueCodec [e] -> Permission -> ListCodec e a -> ValueCodec a Source #
type ArrayCodec a = ListCodec Value a Source #
fromArrayCodec :: Permission -> ArrayCodec a -> ValueCodec a Source #
element :: ValueCodec a -> ArrayCodec a Source #
fromObjectCodec :: Permission -> ObjectCodec a -> ValueCodec a Source #
required :: Name -> ValueCodec a -> ObjectCodec a Source #
optional :: Name -> ValueCodec a -> ObjectCodec (Maybe a) Source #