Frames-map-reduce-0.3.0.0: Frames wrapper for map-reduce-folds and some extra folds helpers.

Safe HaskellNone
LanguageHaskell2010

Frames.MapReduce.Maybe

Synopsis

Documentation

unpackNoOp :: Unpack (record (Maybe :. ElField) rs) (record (Maybe :. ElField) rs) Source #

Don't do anything

unpackFilterRow :: (record (Maybe :. ElField) rs -> Bool) -> Unpack (record (Maybe :. ElField) rs) (record (Maybe :. ElField) rs) Source #

Filter records using a function on the entire record.

unpackFilterOnField :: forall t rs record. (KnownField t, ElemOf rs t, RecGetFieldC t record Maybe rs) => (Maybe (Snd t) -> Bool) -> Unpack (record (Maybe :. ElField) rs) (record (Maybe :. ElField) rs) Source #

Filter records based on a condition on only one field in the row. Will usually require a Type Application to indicate which field.

unpackGoodRows :: forall cs rs record. RCastC cs rs record Maybe => (record (Maybe :. ElField) cs -> Bool) -> Unpack (record (Maybe :. ElField) rs) (record (Maybe :. ElField) rs) Source #

An unpack step which specifies a subset of columns, cs, (via a type-application) and then filters a Rec (Maybe :. Elfield) rs to only rows which have all good data in that subset.

unpackGoodRecRows :: forall cs rs. RCastC cs rs Rec Maybe => Unpack (Rec (Maybe :. ElField) rs) (Rec (Maybe :. ElField) rs) Source #

assignKeysAndData :: forall ks cs rs record. (RCastC ks rs record Maybe, RCastC cs rs record Maybe) => Assign (record (Maybe :. ElField) ks) (record (Maybe :. ElField) rs) (record (Maybe :. ElField) cs) Source #

Assign both keys and data cols. Uses type applications to specify them if they cannot be inferred. Keys usually can't. Data sometimes can.

splitOnKeys :: forall ks rs cs record. (RCastC ks rs record Maybe, RCastC cs rs record Maybe, cs ~ RDeleteAll ks rs) => Assign (record (Maybe :. ElField) ks) (record (Maybe :. ElField) rs) (record (Maybe :. ElField) cs) Source #

Assign keys and leave the rest of the columns, excluding the keys, in the data passed to reduce.

assignKeys :: forall ks rs record. RCastC ks rs record Maybe => Assign (record (Maybe :. ElField) ks) (record (Maybe :. ElField) rs) (record (Maybe :. ElField) rs) Source #

Assign keys and leave all columns, including the keys, in the data passed to reduce.

reduceAndAddKey Source #

Arguments

:: (IsoRec ks record Maybe, IsoRec cs record Maybe, IsoRec (ks ++ cs) record Maybe, RecVec (ks ++ cs)) 
=> (forall h. Foldable h => h x -> record (Maybe :. ElField) cs)

reduction step

-> Reduce (record (Maybe :. ElField) ks) x (record (Maybe :. ElField) (ks ++ cs)) 

Reduce the data to a single row and then re-attach the key.

foldAndAddKey Source #

Arguments

:: (IsoRec ks record Maybe, IsoRec cs record Maybe, IsoRec (ks ++ cs) record Maybe, RecVec (ks ++ cs)) 
=> Fold x (record (Maybe :. ElField) cs)

reduction fold

-> Reduce (record (Maybe :. ElField) ks) x (record (Maybe :. ElField) (ks ++ cs)) 

Reduce by folding the data to a single row and then re-attaching the key.

makeRecsWithKey Source #

Arguments

:: (Functor g, Foldable g, IsoRec ks record Maybe, IsoRec as record Maybe, IsoRec (ks ++ as) record Maybe, RecVec (ks ++ as)) 
=> (y -> record (Maybe :. ElField) as)

map a result to a record

-> Reduce (record (Maybe :. ElField) ks) x (g y)

original reduce

-> Reduce (record (Maybe :. ElField) ks) x (g (record (Maybe :. ElField) (ks ++ as))) 

Transform a reduce which produces a container of results, with a function from each result to a record, into a reduce which produces a FrameRec of the result records with the key re-attached.

makeRecsWithKeyM Source #

Arguments

:: (Monad m, Functor g, Foldable g, IsoRec ks record Maybe, IsoRec as record Maybe, IsoRec (ks ++ as) record Maybe, RecVec (ks ++ as)) 
=> (y -> record (Maybe :. ElField) as)

map a result to a record

-> ReduceM m (record (Maybe :. ElField) ks) x (g y)

original reduce

-> ReduceM m (record (Maybe :. ElField) ks) x (g (record (Maybe :. ElField) (ks ++ as))) 

Transform an effectful reduce which produces a container of results, with a function from each result to a record, into a reduce which produces a FrameRec of the result records with the key re-attached.