analyze-0.1.0.0: making data science easy and safe with data frames

Safe HaskellNone
LanguageHaskell2010

Analyze.Decoding

Description

Applicative decoding with key-value lookups. Think of a Decoder as a row function that exposes the columns it uses.

Synopsis

Documentation

data Arg m k v a Source #

Pair of key and an extraction function.

Constructors

Arg k (v -> m a) 

Instances

Functor m => Functor (Arg m k v) Source # 

Methods

fmap :: (a -> b) -> Arg m k v a -> Arg m k v b #

(<$) :: a -> Arg m k v b -> Arg m k v a #

newtype Decoder m k v a Source #

Free applicative over Arg.

Constructors

Decoder (Ap (Arg m k v) a) 

Instances

Functor (Decoder m k v) Source # 

Methods

fmap :: (a -> b) -> Decoder m k v a -> Decoder m k v b #

(<$) :: a -> Decoder m k v b -> Decoder m k v a #

Applicative (Decoder m k v) Source # 

Methods

pure :: a -> Decoder m k v a #

(<*>) :: Decoder m k v (a -> b) -> Decoder m k v a -> Decoder m k v b #

(*>) :: Decoder m k v a -> Decoder m k v b -> Decoder m k v b #

(<*) :: Decoder m k v a -> Decoder m k v b -> Decoder m k v a #

decoderKeys :: Data k => Decoder m k v a -> [k] Source #

List all column names used in the Decoder.

fromArg :: Arg m k v a -> Decoder m k v a Source #

Lifts a single Arg into a Decoder

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.

runDecoder :: (Data k, Monad m) => Decoder m k v a -> (k -> m v) -> m a Source #

Run a Decoder with a lookup function (typically row lookup).