| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Rel8.Internal.Table.These
Contents
Synopsis
- data TheseTable (context :: Context) a b = TheseTable {
- here :: MaybeTable context a
- there :: MaybeTable context b
- theseTable :: Table Expr c => (a -> c) -> (b -> c) -> (a -> b -> c) -> TheseTable Expr a b -> c
- thisTable :: Table Expr b => a -> TheseTable Expr a b
- thatTable :: Table Expr a => b -> TheseTable Expr a b
- thoseTable :: a -> b -> TheseTable Expr a b
- isThisTable :: TheseTable Expr a b -> Expr Bool
- isThatTable :: TheseTable Expr a b -> Expr Bool
- isThoseTable :: TheseTable Expr a b -> Expr Bool
- hasHereTable :: TheseTable Expr a b -> Expr Bool
- hasThereTable :: TheseTable Expr a b -> Expr Bool
- justHereTable :: forall (context :: Context) a b. TheseTable context a b -> MaybeTable context a
- justThereTable :: forall (context :: Context) a b. TheseTable context a b -> MaybeTable context b
- alignMaybeTable :: MaybeTable Expr a -> MaybeTable Expr b -> MaybeTable Expr (TheseTable Expr a b)
- aggregateThisTable :: forall c a (fold :: Fold) b. Table Expr c => Aggregator a c -> Aggregator' fold (TheseTable Expr a b) c
- aggregateThisTable1 :: forall c (fold :: Fold) a (fold' :: Fold) b. Table Expr c => Aggregator' fold a c -> Aggregator' fold' (TheseTable Expr a b) (MaybeTable Expr c)
- aggregateThatTable :: forall c b (fold :: Fold) a. Table Expr c => Aggregator b c -> Aggregator' fold (TheseTable Expr a b) c
- aggregateThatTable1 :: forall c (fold :: Fold) b (fold' :: Fold) a. Table Expr c => Aggregator' fold b c -> Aggregator' fold' (TheseTable Expr a b) (MaybeTable Expr c)
- aggregateThoseTable :: forall c a b (fold :: Fold). Table Expr c => Aggregator (a, b) c -> Aggregator' fold (TheseTable Expr a b) c
- aggregateThoseTable1 :: forall c (fold :: Fold) a b (fold' :: Fold). Table Expr c => Aggregator' fold (a, b) c -> Aggregator' fold' (TheseTable Expr a b) (MaybeTable Expr c)
- aggregateHereTable :: forall c a (fold :: Fold) b. Table Expr c => Aggregator a c -> Aggregator' fold (TheseTable Expr a b) c
- aggregateHereTable1 :: forall c (fold :: Fold) a (fold' :: Fold) b. Table Expr c => Aggregator' fold a c -> Aggregator' fold' (TheseTable Expr a b) (MaybeTable Expr c)
- aggregateThereTable :: forall c b (fold :: Fold) a. Table Expr c => Aggregator b c -> Aggregator' fold (TheseTable Expr a b) c
- aggregateThereTable1 :: forall c (fold :: Fold) b (fold' :: Fold) a. Table Expr c => Aggregator' fold b c -> Aggregator' fold' (TheseTable Expr a b) (MaybeTable Expr c)
- aggregateTheseTable :: forall (fold :: Fold) i a (fold' :: Fold) i' b. Aggregator' fold i a -> Aggregator' fold' i' b -> Aggregator1 (TheseTable Expr i i') (TheseTable Expr a b)
- nameTheseTable :: Name (Maybe MaybeTag) -> Name (Maybe MaybeTag) -> a -> b -> TheseTable Name a b
Documentation
data TheseTable (context :: Context) a b Source #
TheseTable a b is a Rel8 table that contains either the table a, the
table b, or both tables a and b. You can construct TheseTables using
thisTable, thatTable and thoseTable. TheseTables can be
eliminated/pattern matched using theseTable.
TheseTable is operationally the same as Haskell's These type, but
adapted to work with Rel8.
Constructors
| TheseTable | |
Fields
| |
Instances
| (Table context a, Table context b, Reifiable context, context ~ context') => Table context' (TheseTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These Associated Types
Methods toColumns :: TheseTable context a b -> Columns (TheseTable context a b) context' Source # fromColumns :: Columns (TheseTable context a b) context' -> TheseTable context a b Source # fromResult :: Columns (TheseTable context a b) Result -> FromExprs (TheseTable context a b) Source # toResult :: FromExprs (TheseTable context a b) -> Columns (TheseTable context a b) Result Source # | |||||||||||||
| Nullifiable context => Bifunctor (TheseTable context) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These Methods bimap :: (a -> b) -> (c -> d) -> TheseTable context a c -> TheseTable context b d # first :: (a -> b) -> TheseTable context a c -> TheseTable context b c # second :: (b -> c) -> TheseTable context a b -> TheseTable context a c # | |||||||||||||
| Biprojectable (TheseTable context) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These Methods biproject :: (Projecting a b, Projecting c d) => Projection a b -> Projection c d -> TheseTable context a c -> TheseTable context b d Source # | |||||||||||||
| (context ~ Expr, Table Expr a, Semigroup a) => Applicative (TheseTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These Methods pure :: a0 -> TheseTable context a a0 # (<*>) :: TheseTable context a (a0 -> b) -> TheseTable context a a0 -> TheseTable context a b # liftA2 :: (a0 -> b -> c) -> TheseTable context a a0 -> TheseTable context a b -> TheseTable context a c # (*>) :: TheseTable context a a0 -> TheseTable context a b -> TheseTable context a b # (<*) :: TheseTable context a a0 -> TheseTable context a b -> TheseTable context a a0 # | |||||||||||||
| Nullifiable context => Functor (TheseTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These Methods fmap :: (a0 -> b) -> TheseTable context a a0 -> TheseTable context a b # (<$) :: a0 -> TheseTable context a b -> TheseTable context a a0 # | |||||||||||||
| (context ~ Expr, Table Expr a, Semigroup a) => Monad (TheseTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These Methods (>>=) :: TheseTable context a a0 -> (a0 -> TheseTable context a b) -> TheseTable context a b # (>>) :: TheseTable context a a0 -> TheseTable context a b -> TheseTable context a b # return :: a0 -> TheseTable context a a0 # | |||||||||||||
| Projectable (TheseTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These Methods project :: Projecting a0 b => Projection a0 b -> TheseTable context a a0 -> TheseTable context a b Source # | |||||||||||||
| (context ~ Expr, Table Expr a, Semigroup a) => Apply (TheseTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These Methods (<.>) :: TheseTable context a (a0 -> b) -> TheseTable context a a0 -> TheseTable context a b (.>) :: TheseTable context a a0 -> TheseTable context a b -> TheseTable context a b (<.) :: TheseTable context a a0 -> TheseTable context a b -> TheseTable context a a0 liftF2 :: (a0 -> b -> c) -> TheseTable context a a0 -> TheseTable context a b -> TheseTable context a c | |||||||||||||
| (context ~ Expr, Table Expr a, Semigroup a) => Bind (TheseTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These Methods (>>-) :: TheseTable context a a0 -> (a0 -> TheseTable context a b) -> TheseTable context a b join :: TheseTable context a (TheseTable context a a0) -> TheseTable context a a0 | |||||||||||||
| (context ~ Expr, Table Expr a, Table Expr b, Semigroup a, Semigroup b) => Semigroup (TheseTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These Methods (<>) :: TheseTable context a b -> TheseTable context a b -> TheseTable context a b # sconcat :: NonEmpty (TheseTable context a b) -> TheseTable context a b # stimes :: Integral b0 => b0 -> TheseTable context a b -> TheseTable context a b # | |||||||||||||
| (EqTable a, EqTable b, context ~ Expr) => EqTable (TheseTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These | |||||||||||||
| (OrdTable a, OrdTable b, context ~ Expr) => OrdTable (TheseTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These | |||||||||||||
| type Transpose to (TheseTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These | |||||||||||||
| type Columns (TheseTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These | |||||||||||||
| type Context (TheseTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These | |||||||||||||
| type FromExprs (TheseTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.These | |||||||||||||
theseTable :: Table Expr c => (a -> c) -> (b -> c) -> (a -> b -> c) -> TheseTable Expr a b -> c Source #
Pattern match on a TheseTable. Corresponds to these.
thisTable :: Table Expr b => a -> TheseTable Expr a b Source #
Construct a TheseTable. Corresponds to This.
thatTable :: Table Expr a => b -> TheseTable Expr a b Source #
Construct a TheseTable. Corresponds to That.
thoseTable :: a -> b -> TheseTable Expr a b Source #
Construct a TheseTable. Corresponds to These.
isThisTable :: TheseTable Expr a b -> Expr Bool Source #
Test if a TheseTable was constructed with thisTable.
Corresponds to isThis.
isThatTable :: TheseTable Expr a b -> Expr Bool Source #
Test if a TheseTable was constructed with thatTable.
Corresponds to isThat.
isThoseTable :: TheseTable Expr a b -> Expr Bool Source #
Test if a TheseTable was constructed with thoseTable.
Corresponds to isThese.
hasHereTable :: TheseTable Expr a b -> Expr Bool Source #
Test if the a side of TheseTable a b is present.
Corresponds to hasHere.
hasThereTable :: TheseTable Expr a b -> Expr Bool Source #
Test if the b table of TheseTable a b is present.
Corresponds to hasThere.
justHereTable :: forall (context :: Context) a b. TheseTable context a b -> MaybeTable context a Source #
Attempt to project out the a table of a TheseTable a b.
Corresponds to justHere.
justThereTable :: forall (context :: Context) a b. TheseTable context a b -> MaybeTable context b Source #
Attempt to project out the b table of a TheseTable a b.
Corresponds to justThere.
alignMaybeTable :: MaybeTable Expr a -> MaybeTable Expr b -> MaybeTable Expr (TheseTable Expr a b) Source #
Construct a TheseTable from two MaybeTables.
aggregateThisTable :: forall c a (fold :: Fold) b. Table Expr c => Aggregator a c -> Aggregator' fold (TheseTable Expr a b) c Source #
Lift an Aggregator to operate on a TheseTable. If the input query has
s, they are folded into a single thisTable ac by the given aggregator
— in the case where the input query is all thatTables or thoseTables,
the Aggregator's fallback c is returned.
aggregateThisTable1 :: forall c (fold :: Fold) a (fold' :: Fold) b. Table Expr c => Aggregator' fold a c -> Aggregator' fold' (TheseTable Expr a b) (MaybeTable Expr c) Source #
Lift an Aggregator1 to operate on a TheseTable. If the input query
has s, they are folded into a single thisTable a
by the given aggregator — in the case where the input query is all
justTable cthatTables or thoseTables, a single nothingTable row is returned.
aggregateThatTable :: forall c b (fold :: Fold) a. Table Expr c => Aggregator b c -> Aggregator' fold (TheseTable Expr a b) c Source #
Lift an Aggregator to operate on a TheseTable. If the input query has
s, they are folded into a single thatTable bc by the given aggregator
— in the case where the input query is all thisTables or thoseTables,
the Aggregator's fallback c is returned.
aggregateThatTable1 :: forall c (fold :: Fold) b (fold' :: Fold) a. Table Expr c => Aggregator' fold b c -> Aggregator' fold' (TheseTable Expr a b) (MaybeTable Expr c) Source #
Lift an Aggregator1 to operate on a TheseTable. If the input query
has s, they are folded into a single thatTable b
by the given aggregator — in the case where the input query is all
justTable cthisTables or thoseTables, a single nothingTable row is returned.
aggregateThoseTable :: forall c a b (fold :: Fold). Table Expr c => Aggregator (a, b) c -> Aggregator' fold (TheseTable Expr a b) c Source #
Lift an Aggregator to operate on a ThoseTable. If the input query has
s, they are folded into a single thoseTable a bc by the given
aggregator — in the case where the input query is all thisTables or
thatTables, the Aggregator's fallback c is returned.
aggregateThoseTable1 :: forall c (fold :: Fold) a b (fold' :: Fold). Table Expr c => Aggregator' fold (a, b) c -> Aggregator' fold' (TheseTable Expr a b) (MaybeTable Expr c) Source #
Lift an Aggregator1 to operate on a TheseTable. If the input query
has s, they are folded into a single thoseTable a b
by the given aggregator — in the case where the input query is all
justTable cthisTables or thatTables, a single nothingTable row is returned.
aggregateHereTable :: forall c a (fold :: Fold) b. Table Expr c => Aggregator a c -> Aggregator' fold (TheseTable Expr a b) c Source #
Lift an Aggregator to operate on a TheseTable. If the input query has
s or thisTable as, the thoseTable a _as are folded into a single
c by the given aggregator — in the case where the input query is all
thatTables, the Aggregator's fallback c is returned.
aggregateHereTable1 :: forall c (fold :: Fold) a (fold' :: Fold) b. Table Expr c => Aggregator' fold a c -> Aggregator' fold' (TheseTable Expr a b) (MaybeTable Expr c) Source #
Lift an Aggregator1 to operate on an TheseTable. If the input query
has s or thisTable as, the thoseTable a _as are folded into a
single by the given aggregator — in the case where
the input query is all justTable cthatTables, a single nothingTable row is
returned.
aggregateThereTable :: forall c b (fold :: Fold) a. Table Expr c => Aggregator b c -> Aggregator' fold (TheseTable Expr a b) c Source #
Lift an Aggregator to operate on a TheseTable. If the input query has
s or thatTable bs, the thoseTable _ bbs are folded into a single
c by the given aggregator — in the case where the input query is all
thisTables, the Aggregator's fallback c is returned.
aggregateThereTable1 :: forall c (fold :: Fold) b (fold' :: Fold) a. Table Expr c => Aggregator' fold b c -> Aggregator' fold' (TheseTable Expr a b) (MaybeTable Expr c) Source #
Lift an Aggregator1 to operate on an TheseTable. If the input query
has s or thatTable bs, the thoseTable _ bbs are folded into a
single by the given aggregator — in the case where
the input query is all justTable cthisTables, a single nothingTable row is
returned.
aggregateTheseTable :: forall (fold :: Fold) i a (fold' :: Fold) i' b. Aggregator' fold i a -> Aggregator' fold' i' b -> Aggregator1 (TheseTable Expr i i') (TheseTable Expr a b) Source #
Lift a pair aggregators to operate on a TheseTable. thisTables,
thatTables are thoseTables are grouped separately.
Arguments
| :: Name (Maybe MaybeTag) | The name of the column to track the presence of the |
| -> Name (Maybe MaybeTag) | The name of the column to track the presence of the |
| -> a | Names of the columns in the |
| -> b | Names of the columns in the |
| -> TheseTable Name a b |
Construct a TheseTable in the Name context. This can be useful if you
have a TheseTable that you are storing in a table and need to construct a
TableSchema.