Safe Haskell | None |
---|---|
Language | Haskell2010 |
Applicative decoding with key-value lookups.
Think of a Decoder
as a row function that exposes the columns it uses.
- data Arg m k v a = Arg k (v -> m a)
- newtype Decoder m k v a = Decoder (Ap (Arg m k v) a)
- decoderKeys :: Data k => Decoder m k v a -> [k]
- fromArg :: Arg m k v a -> Decoder m k v a
- require :: Applicative m => k -> Decoder m k v v
- requireWhere :: k -> (k -> v -> m a) -> Decoder m k v a
- runDecoder :: (Data k, Monad m) => Decoder m k v a -> (k -> m v) -> m a
Documentation
Pair of key and an extraction function.
Arg k (v -> m a) |
require :: Applicative m => k -> Decoder m k v v Source #
Simple Decoder
that just looks up and returns the value for a given key.
requireWhere :: k -> (k -> v -> m a) -> Decoder m k v a Source #
Shorthand for lookup and transform.