Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class RecGetFieldC t record f rs where
- rgetF :: (KnownField t, ElemOf rs t) => record (f :. ElField) rs -> (f :. ElField) t
- rgetFieldF :: (KnownField t, Functor f, ElemOf rs t) => record (f :. ElField) rs -> f (Snd t)
- class RCastC rs ss record f where
- class IsoRec rs record f where
- isoRecAppend :: forall f record (as :: [(Symbol, Type)]) bs. (IsoRec as record f, IsoRec bs record f, IsoRec (as ++ bs) record f) => record (f :. ElField) as -> record (f :. ElField) bs -> record (f :. ElField) (as ++ bs)
- unpackNoOp :: Unpack (record (f :. ElField) rs) (record (f :. ElField) rs)
- unpackFilterRow :: (record (f :. ElField) rs -> Bool) -> Unpack (record (f :. ElField) rs) (record (f :. ElField) rs)
- unpackFilterOnField :: forall t rs record f. (Functor f, KnownField t, ElemOf rs t, RecGetFieldC t record f rs) => (f (Snd t) -> Bool) -> Unpack (record (f :. ElField) rs) (record (f :. ElField) rs)
- unpackFilterOnGoodField :: forall t rs record f. (Functor f, KnownField t, ElemOf rs t, RecGetFieldC t record f rs) => (forall a. f a -> Maybe a) -> (Snd t -> Bool) -> Unpack (record (f :. ElField) rs) (record (f :. ElField) rs)
- unpackGoodRows :: forall cs rs record f. RCastC cs rs record f => (record (f :. ElField) cs -> Bool) -> Unpack (record (f :. ElField) rs) (record (f :. ElField) rs)
- assignKeysAndData :: forall ks cs rs record f. (RCastC ks rs record f, RCastC cs rs record f) => Assign (record (f :. ElField) ks) (record (f :. ElField) rs) (record (f :. ElField) cs)
- splitOnKeys :: forall ks rs cs record f. (RCastC ks rs record f, RCastC cs rs record f, cs ~ RDeleteAll ks rs) => Assign (record (f :. ElField) ks) (record (f :. ElField) rs) (record (f :. ElField) cs)
- splitOnData :: forall cs rs ks record f. (RCastC ks rs record f, RCastC cs rs record f, ks ~ RDeleteAll cs rs) => Assign (record (f :. ElField) ks) (record (f :. ElField) rs) (record (f :. ElField) cs)
- assignKeys :: forall ks rs record f. RCastC ks rs record f => Assign (record (f :. ElField) ks) (record (f :. ElField) rs) (record (f :. ElField) rs)
- reduceAndAddKey :: forall ks cs x record f. (IsoRec ks record f, IsoRec cs record f, IsoRec (ks ++ cs) record f) => (forall h. Foldable h => h x -> record (f :. ElField) cs) -> Reduce (record (f :. ElField) ks) x (record (f :. ElField) (ks ++ cs))
- foldAndAddKey :: (IsoRec ks record f, IsoRec cs record f, IsoRec (ks ++ cs) record f) => Fold x (record (f :. ElField) cs) -> Reduce (record (f :. ElField) ks) x (record (f :. ElField) (ks ++ cs))
- makeRecsWithKey :: (Functor g, Foldable g, IsoRec ks record f, IsoRec as record f, IsoRec (ks ++ as) record f) => (y -> record (f :. ElField) as) -> Reduce (record (f :. ElField) ks) x (g y) -> Reduce (record (f :. ElField) ks) x (g (record (f :. ElField) (ks ++ as)))
- makeRecsWithKeyM :: (Monad m, Functor g, Foldable g, IsoRec ks record f, IsoRec as record f, IsoRec (ks ++ as) record f) => (y -> record (f :. ElField) as) -> ReduceM m (record (f :. ElField) ks) x (g y) -> ReduceM m (record (f :. ElField) ks) x (g (record (f :. ElField) (ks ++ as)))
Documentation
class RecGetFieldC t record f rs where Source #
rgetF :: (KnownField t, ElemOf rs t) => record (f :. ElField) rs -> (f :. ElField) t Source #
rgetFieldF :: (KnownField t, Functor f, ElemOf rs t) => record (f :. ElField) rs -> f (Snd t) Source #
Instances
FieldOffset (f :. ElField) rs t => RecGetFieldC t (SRec :: ((Symbol, Type) -> Type) -> [(Symbol, Type)] -> Type) f rs Source # | |
RecGetFieldC t (ARec :: ((Symbol, Type) -> Type) -> [(Symbol, Type)] -> Type) f rs Source # | |
RecGetFieldC t (Rec :: ((Symbol, Type) -> Type) -> [(Symbol, Type)] -> Type) f rs Source # | |
class RCastC rs ss record f where Source #
Instances
(RPureConstrained (FieldOffset (f :. ElField) ss) rs, RPureConstrained (FieldOffset (f :. ElField) rs) rs, RFoldMap rs, RMap rs, RApply rs, Storable (Rec (f :. ElField) rs)) => RCastC (rs :: [(Symbol, Type)]) (ss :: [(Symbol, Type)]) (SRec :: ((Symbol, Type) -> Type) -> [(Symbol, Type)] -> Type) f Source # | |
(IndexWitnesses (RImage rs ss), NatToInt (RLength rs)) => RCastC (rs :: [(Symbol, Type)]) (ss :: [(Symbol, Type)]) (ARec :: ((Symbol, Type) -> Type) -> [(Symbol, Type)] -> Type) f Source # | |
RecSubset (Rec :: ((Symbol, Type) -> Type) -> [(Symbol, Type)] -> Type) rs ss (RImage rs ss) => RCastC (rs :: [(Symbol, Type)]) (ss :: [(Symbol, Type)]) (Rec :: ((Symbol, Type) -> Type) -> [(Symbol, Type)] -> Type) f Source # | |
class IsoRec rs record f where Source #
toRec :: record (f :. ElField) rs -> Rec (f :. ElField) rs Source #
fromRec :: Rec (f :. ElField) rs -> record (f :. ElField) rs Source #
Instances
(NatToInt (RLength rs), RecApplicative rs, RPureConstrained (IndexableField rs) rs) => IsoRec rs (ARec :: ((Symbol, Type) -> Type) -> [(Symbol, Type)] -> Type) f Source # | |
Storable (Rec (f :. ElField) rs) => IsoRec rs (SRec :: ((Symbol, Type) -> Type) -> [(Symbol, Type)] -> Type) f Source # | |
IsoRec rs (Rec :: ((Symbol, Type) -> Type) -> [(Symbol, Type)] -> Type) f Source # | |
isoRecAppend :: forall f record (as :: [(Symbol, Type)]) bs. (IsoRec as record f, IsoRec bs record f, IsoRec (as ++ bs) record f) => record (f :. ElField) as -> record (f :. ElField) bs -> record (f :. ElField) (as ++ bs) Source #
unpackNoOp :: Unpack (record (f :. ElField) rs) (record (f :. ElField) rs) Source #
Don't do anything
unpackFilterRow :: (record (f :. ElField) rs -> Bool) -> Unpack (record (f :. ElField) rs) (record (f :. ElField) rs) Source #
Filter records using a function on the entire record.
unpackFilterOnField :: forall t rs record f. (Functor f, KnownField t, ElemOf rs t, RecGetFieldC t record f rs) => (f (Snd t) -> Bool) -> Unpack (record (f :. ElField) rs) (record (f :. 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.
unpackFilterOnGoodField :: forall t rs record f. (Functor f, KnownField t, ElemOf rs t, RecGetFieldC t record f rs) => (forall a. f a -> Maybe a) -> (Snd t -> Bool) -> Unpack (record (f :. ElField) rs) (record (f :. ElField) rs) Source #
unpackGoodRows :: forall cs rs record f. RCastC cs rs record f => (record (f :. ElField) cs -> Bool) -> Unpack (record (f :. ElField) rs) (record (f :. ElField) rs) Source #
An unpack step which specifies a subset of columns, cs,
(via a type-application) and then filters a record (Maybe :. Elfield) rs
to only rows which have all good data in that subset.
assignKeysAndData :: forall ks cs rs record f. (RCastC ks rs record f, RCastC cs rs record f) => Assign (record (f :. ElField) ks) (record (f :. ElField) rs) (record (f :. 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 f. (RCastC ks rs record f, RCastC cs rs record f, cs ~ RDeleteAll ks rs) => Assign (record (f :. ElField) ks) (record (f :. ElField) rs) (record (f :. ElField) cs) Source #
Assign keys and leave the rest of the columns, excluding the keys, in the data passed to reduce.
splitOnData :: forall cs rs ks record f. (RCastC ks rs record f, RCastC cs rs record f, ks ~ RDeleteAll cs rs) => Assign (record (f :. ElField) ks) (record (f :. ElField) rs) (record (f :. ElField) cs) Source #
Assign data and leave the rest of the columns, excluding the data, as the keys.
assignKeys :: forall ks rs record f. RCastC ks rs record f => Assign (record (f :. ElField) ks) (record (f :. ElField) rs) (record (f :. ElField) rs) Source #
Assign keys and leave all columns, including the keys, in the data passed to reduce.
:: forall ks cs x record f. (IsoRec ks record f, IsoRec cs record f, IsoRec (ks ++ cs) record f) | |
=> (forall h. Foldable h => h x -> record (f :. ElField) cs) | reduction step |
-> Reduce (record (f :. ElField) ks) x (record (f :. ElField) (ks ++ cs)) |
Reduce the data to a single row and then re-attach the key. | NB: for all but Rec case, this will have to convert record to Rec and back for the append
:: (IsoRec ks record f, IsoRec cs record f, IsoRec (ks ++ cs) record f) | |
=> Fold x (record (f :. ElField) cs) | reduction fold |
-> Reduce (record (f :. ElField) ks) x (record (f :. ElField) (ks ++ cs)) |
Reduce by folding the data to a single row and then re-attaching the key.
:: (Functor g, Foldable g, IsoRec ks record f, IsoRec as record f, IsoRec (ks ++ as) record f) | |
=> (y -> record (f :. ElField) as) | map a result to a record |
-> Reduce (record (f :. ElField) ks) x (g y) | original reduce |
-> Reduce (record (f :. ElField) ks) x (g (record (f :. 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 foldable (based on the original reduce) of the result records with the key re-attached.
:: (Monad m, Functor g, Foldable g, IsoRec ks record f, IsoRec as record f, IsoRec (ks ++ as) record f) | |
=> (y -> record (f :. ElField) as) | map a result to a record |
-> ReduceM m (record (f :. ElField) ks) x (g y) | original reduce |
-> ReduceM m (record (f :. ElField) ks) x (g (record (f :. 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 foldable (based on the original reduce) of the result records with the key re-attached.
Orphan instances
(KnownField t, Functor f, RecGetFieldC t record f (t ': rs), RCastC rs (t ': rs) record f, Hashable (f (Snd t)), Hashable (record (f :. ElField) rs)) => Hashable (record (f :. ElField) (t ': rs)) Source # | |
Hashable (record (f :. ElField) ('[] :: [k])) Source # | This is only here so we can use hash maps for the grouping step. This should properly be in Frames itself. |