| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Rel8.Internal.Table.Either
Contents
Synopsis
- data EitherTable (context :: Context) a b = EitherTable {}
- eitherTable :: Table Expr c => (a -> c) -> (b -> c) -> EitherTable Expr a b -> c
- leftTable :: Table Expr b => a -> EitherTable Expr a b
- rightTable :: Table Expr a => b -> EitherTable Expr a b
- isLeftTable :: EitherTable Expr a b -> Expr Bool
- isRightTable :: EitherTable Expr a b -> Expr Bool
- aggregateLeftTable :: forall c a (fold :: Fold) b. Table Expr c => Aggregator a c -> Aggregator' fold (EitherTable Expr a b) c
- aggregateLeftTable1 :: forall c (fold :: Fold) a (fold' :: Fold) b. Table Expr c => Aggregator' fold a c -> Aggregator' fold' (EitherTable Expr a b) (MaybeTable Expr c)
- aggregateRightTable :: forall c b (fold :: Fold) a. Table Expr c => Aggregator b c -> Aggregator' fold (EitherTable Expr a b) c
- aggregateRightTable1 :: forall c (fold :: Fold) a (fold' :: Fold) b. Table Expr c => Aggregator' fold a c -> Aggregator' fold' (EitherTable Expr a b) (MaybeTable Expr c)
- aggregateEitherTable :: forall (fold :: Fold) i a (fold' :: Fold) i' b. Aggregator' fold i a -> Aggregator' fold' i' b -> Aggregator1 (EitherTable Expr i i') (EitherTable Expr a b)
- nameEitherTable :: Name EitherTag -> a -> b -> EitherTable Name a b
Documentation
data EitherTable (context :: Context) a b Source #
An EitherTable a b is a Rel8 table that contains either the table a or
the table b. You can construct an EitherTable using leftTable and
rightTable, and eliminate/pattern match using eitherTable.
An EitherTable is operationally the same as Haskell's Either type, but
adapted to work with Rel8.
Constructors
| EitherTable | |
Instances
| (Table context a, Table context b, Reifiable context, context ~ context') => Table context' (EitherTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either Associated Types
Methods toColumns :: EitherTable context a b -> Columns (EitherTable context a b) context' Source # fromColumns :: Columns (EitherTable context a b) context' -> EitherTable context a b Source # fromResult :: Columns (EitherTable context a b) Result -> FromExprs (EitherTable context a b) Source # toResult :: FromExprs (EitherTable context a b) -> Columns (EitherTable context a b) Result Source # | |||||||||||||
| Nullifiable context => Bifunctor (EitherTable context) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either Methods bimap :: (a -> b) -> (c -> d) -> EitherTable context a c -> EitherTable context b d # first :: (a -> b) -> EitherTable context a c -> EitherTable context b c # second :: (b -> c) -> EitherTable context a b -> EitherTable context a c # | |||||||||||||
| Biprojectable (EitherTable context) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either Methods biproject :: (Projecting a b, Projecting c d) => Projection a b -> Projection c d -> EitherTable context a c -> EitherTable context b d Source # | |||||||||||||
| (context ~ Expr, Table Expr a) => Applicative (EitherTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either Methods pure :: a0 -> EitherTable context a a0 # (<*>) :: EitherTable context a (a0 -> b) -> EitherTable context a a0 -> EitherTable context a b # liftA2 :: (a0 -> b -> c) -> EitherTable context a a0 -> EitherTable context a b -> EitherTable context a c # (*>) :: EitherTable context a a0 -> EitherTable context a b -> EitherTable context a b # (<*) :: EitherTable context a a0 -> EitherTable context a b -> EitherTable context a a0 # | |||||||||||||
| Nullifiable context => Functor (EitherTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either Methods fmap :: (a0 -> b) -> EitherTable context a a0 -> EitherTable context a b # (<$) :: a0 -> EitherTable context a b -> EitherTable context a a0 # | |||||||||||||
| (context ~ Expr, Table Expr a) => Monad (EitherTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either Methods (>>=) :: EitherTable context a a0 -> (a0 -> EitherTable context a b) -> EitherTable context a b # (>>) :: EitherTable context a a0 -> EitherTable context a b -> EitherTable context a b # return :: a0 -> EitherTable context a a0 # | |||||||||||||
| Projectable (EitherTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either Methods project :: Projecting a0 b => Projection a0 b -> EitherTable context a a0 -> EitherTable context a b Source # | |||||||||||||
| (context ~ Expr, Table Expr a) => Apply (EitherTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either Methods (<.>) :: EitherTable context a (a0 -> b) -> EitherTable context a a0 -> EitherTable context a b (.>) :: EitherTable context a a0 -> EitherTable context a b -> EitherTable context a b (<.) :: EitherTable context a a0 -> EitherTable context a b -> EitherTable context a a0 liftF2 :: (a0 -> b -> c) -> EitherTable context a a0 -> EitherTable context a b -> EitherTable context a c | |||||||||||||
| (context ~ Expr, Table Expr a) => Bind (EitherTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either Methods (>>-) :: EitherTable context a a0 -> (a0 -> EitherTable context a b) -> EitherTable context a b join :: EitherTable context a (EitherTable context a a0) -> EitherTable context a a0 | |||||||||||||
| (context ~ Expr, Table Expr a, Table Expr b) => Semigroup (EitherTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either Methods (<>) :: EitherTable context a b -> EitherTable context a b -> EitherTable context a b # sconcat :: NonEmpty (EitherTable context a b) -> EitherTable context a b # stimes :: Integral b0 => b0 -> EitherTable context a b -> EitherTable context a b # | |||||||||||||
| (EqTable a, EqTable b, context ~ Expr) => EqTable (EitherTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either | |||||||||||||
| (OrdTable a, OrdTable b, context ~ Expr) => OrdTable (EitherTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either | |||||||||||||
| type Transpose to (EitherTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either | |||||||||||||
| type Columns (EitherTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either | |||||||||||||
| type Context (EitherTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either | |||||||||||||
| type FromExprs (EitherTable context a b) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Either | |||||||||||||
eitherTable :: Table Expr c => (a -> c) -> (b -> c) -> EitherTable Expr a b -> c Source #
Pattern match/eliminate an EitherTable, by providing mappings from a
leftTable and rightTable.
leftTable :: Table Expr b => a -> EitherTable Expr a b Source #
Construct a left EitherTable. Like Left.
rightTable :: Table Expr a => b -> EitherTable Expr a b Source #
Construct a right EitherTable. Like Right.
isLeftTable :: EitherTable Expr a b -> Expr Bool Source #
Test if an EitherTable is a leftTable.
isRightTable :: EitherTable Expr a b -> Expr Bool Source #
Test if an EitherTable is a rightTable.
aggregateLeftTable :: forall c a (fold :: Fold) b. Table Expr c => Aggregator a c -> Aggregator' fold (EitherTable Expr a b) c Source #
Lift an Aggregator to operate on an EitherTable. If the input query has
s, they are folded into a single leftTable ac by the given aggregator
— in the case where the input query is all rightTables, the
Aggregator's fallback c is returned.
aggregateLeftTable1 :: forall c (fold :: Fold) a (fold' :: Fold) b. Table Expr c => Aggregator' fold a c -> Aggregator' fold' (EitherTable Expr a b) (MaybeTable Expr c) Source #
Lift an Aggregator1 to operate on an EitherTable. If the input query
has s, they are folded into a single leftTable a
by the given aggregator — in the case where the input query is all
justTable crightTables, a single nothingTable row is returned.
aggregateRightTable :: forall c b (fold :: Fold) a. Table Expr c => Aggregator b c -> Aggregator' fold (EitherTable Expr a b) c Source #
Lift an Aggregator to operate on an EitherTable. If the input query has
s, they are folded into a single rightTable bc by the given aggregator
— in the case where the input query is all rightTables, the
Aggregator's fallback c is returned.
aggregateRightTable1 :: forall c (fold :: Fold) a (fold' :: Fold) b. Table Expr c => Aggregator' fold a c -> Aggregator' fold' (EitherTable Expr a b) (MaybeTable Expr c) Source #
Lift an Aggregator1 to operate on an EitherTable. If the input query
has s, they are folded into a single rightTable b
by the given aggregator — in the case where the input query is all
justTable cleftTables, a single nothingTable row is returned.
aggregateEitherTable :: forall (fold :: Fold) i a (fold' :: Fold) i' b. Aggregator' fold i a -> Aggregator' fold' i' b -> Aggregator1 (EitherTable Expr i i') (EitherTable Expr a b) Source #
Lift a pair aggregators to operate on an EitherTable. leftTables and
rightTables are grouped separately.
Arguments
| :: Name EitherTag | The name of the column to track whether a row is a |
| -> a | Names of the columns in the |
| -> b | Names of the columns in the |
| -> EitherTable Name a b |
Construct a EitherTable in the Name context. This can be useful if you
have a EitherTable that you are storing in a table and need to construct a
TableSchema.