| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Rel8.Internal.Table
Synopsis
- class (HTable (Columns a), context ~ Context a, a ~ Transpose context a) => Table (context :: Context) a | a -> context where
- class Columns a ~ Columns b => Congruent a b
- data TTable (a :: Context) b c
- data TColumns a (b :: HTable)
- data TContext a (b :: Context)
- data TFromExprs a b
- data TTranspose (a :: Context) b c
- data TSerialize a b c
Documentation
class (HTable (Columns a), context ~ Context a, a ~ Transpose context a) => Table (context :: Context) a | a -> context where Source #
Tables are one of the foundational elements of Rel8, and describe data
types that have a finite number of columns. Each of these columns contains
data under a shared context, and contexts describe how to interpret the
metadata about a column to a particular Haskell type. In Rel8, we have
contexts for expressions (the Expr context), aggregations (the
Aggregate context), insert values (the Insert context), among
others.
In typical usage of Rel8 you don't need to derive instances of Table
yourself, as anything that's an instance of Rel8able is always a
Table.
Minimal complete definition
Nothing
Associated Types
type Columns a :: HTable Source #
The HTable functor that describes the schema of this table.
type Context a :: Context Source #
The common context that all columns use as an interpretation.
The FromExprs type family maps a type in the Expr context to the
corresponding Haskell type.
type FromExprs a = Map TFromExprs a
type Transpose (context' :: Context) a Source #
type Transpose (context' :: Context) a = Map (TTranspose context') a
Methods
toColumns :: a -> Columns a context Source #
default toColumns :: (Generic (Record a), GTable (TTable context) TColumns (Rep (Record a)), Columns a ~ GColumns TColumns (Rep (Record a))) => a -> Columns a context Source #
fromColumns :: Columns a context -> a Source #
default fromColumns :: (Generic (Record a), GTable (TTable context) TColumns (Rep (Record a)), Columns a ~ GColumns TColumns (Rep (Record a))) => Columns a context -> a Source #
Instances
| Sql DBType a => Table Expr (Expr a) Source # | |||||||||||||
Defined in Rel8.Internal.Expr Associated Types
| |||||||||||||
| Sql DBType a => Table Name (Name a) Source # | |||||||||||||
Defined in Rel8.Internal.Schema.Name Associated Types
| |||||||||||||
| Sql DBType a => Table Result (Identity a) Source # | |||||||||||||
Defined in Rel8.Internal.Table Associated Types
| |||||||||||||
| (Rel8able t, Reifiable context, context ~ context') => Table context' (t context) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Rel8able Associated Types
| |||||||||||||
| (Table context a, Table context b) => Table context (a, b) Source # | |||||||||||||
Defined in Rel8.Internal.Table Associated Types
| |||||||||||||
| (HTable columns, context ~ context') => Table context' (Cols context columns) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Cols Associated Types
Methods toColumns :: Cols context columns -> Columns (Cols context columns) context' Source # fromColumns :: Columns (Cols context columns) context' -> Cols context columns Source # fromResult :: Columns (Cols context columns) Result -> FromExprs (Cols context columns) Source # toResult :: FromExprs (Cols context columns) -> Columns (Cols context columns) Result Source # | |||||||||||||
| (Table context a, context ~ context') => Table context' (ListTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.List Associated Types
Methods toColumns :: ListTable context a -> Columns (ListTable context a) context' Source # fromColumns :: Columns (ListTable context a) context' -> ListTable context a Source # fromResult :: Columns (ListTable context a) Result -> FromExprs (ListTable context a) Source # toResult :: FromExprs (ListTable context a) -> Columns (ListTable context a) Result Source # | |||||||||||||
| (Table context a, Reifiable context, context ~ context') => Table context' (MaybeTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Maybe Associated Types
Methods toColumns :: MaybeTable context a -> Columns (MaybeTable context a) context' Source # fromColumns :: Columns (MaybeTable context a) context' -> MaybeTable context a Source # fromResult :: Columns (MaybeTable context a) Result -> FromExprs (MaybeTable context a) Source # toResult :: FromExprs (MaybeTable context a) -> Columns (MaybeTable context a) Result Source # | |||||||||||||
| (Table context a, context ~ context') => Table context' (NonEmptyTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.NonEmpty Associated Types
Methods toColumns :: NonEmptyTable context a -> Columns (NonEmptyTable context a) context' Source # fromColumns :: Columns (NonEmptyTable context a) context' -> NonEmptyTable context a Source # fromResult :: Columns (NonEmptyTable context a) Result -> FromExprs (NonEmptyTable context a) Source # toResult :: FromExprs (NonEmptyTable context a) -> Columns (NonEmptyTable context a) Result Source # | |||||||||||||
| (Table context a, Reifiable context, context ~ context') => Table context' (NullTable context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Null Associated Types
Methods toColumns :: NullTable context a -> Columns (NullTable context a) context' Source # fromColumns :: Columns (NullTable context a) context' -> NullTable context a Source # fromResult :: Columns (NullTable context a) Result -> FromExprs (NullTable context a) Source # toResult :: FromExprs (NullTable context a) -> Columns (NullTable context a) Result Source # | |||||||||||||
| (Table context a, Reifiable context, context ~ context') => Table context' (Nullify context a) Source # | |||||||||||||
Defined in Rel8.Internal.Table.Nullify Associated Types
Methods toColumns :: Nullify context a -> Columns (Nullify context a) context' Source # fromColumns :: Columns (Nullify context a) context' -> Nullify context a Source # fromResult :: Columns (Nullify context a) Result -> FromExprs (Nullify context a) Source # toResult :: FromExprs (Nullify context a) -> Columns (Nullify context a) Result Source # | |||||||||||||
| (Table context a, Table context b, Table context c) => Table context (a, b, c) Source # | |||||||||||||
Defined in Rel8.Internal.Table Associated Types
| |||||||||||||
| (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 # | |||||||||||||
| (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 # | |||||||||||||
| (Table context a, Table context b, Table context c, Table context d) => Table context (a, b, c, d) Source # | |||||||||||||
Defined in Rel8.Internal.Table Associated Types
| |||||||||||||
| (Table context a, Table context b, Table context c, Table context d, Table context e) => Table context (a, b, c, d, e) Source # | |||||||||||||
Defined in Rel8.Internal.Table Associated Types
Methods toColumns :: (a, b, c, d, e) -> Columns (a, b, c, d, e) context Source # fromColumns :: Columns (a, b, c, d, e) context -> (a, b, c, d, e) Source # fromResult :: Columns (a, b, c, d, e) Result -> FromExprs (a, b, c, d, e) Source # toResult :: FromExprs (a, b, c, d, e) -> Columns (a, b, c, d, e) Result Source # | |||||||||||||
| (Table context a, Table context b, Table context c, Table context d, Table context e, Table context f) => Table context (a, b, c, d, e, f) Source # | |||||||||||||
Defined in Rel8.Internal.Table Associated Types
Methods toColumns :: (a, b, c, d, e, f) -> Columns (a, b, c, d, e, f) context Source # fromColumns :: Columns (a, b, c, d, e, f) context -> (a, b, c, d, e, f) Source # fromResult :: Columns (a, b, c, d, e, f) Result -> FromExprs (a, b, c, d, e, f) Source # toResult :: FromExprs (a, b, c, d, e, f) -> Columns (a, b, c, d, e, f) Result Source # | |||||||||||||
| (Table context a, Table context b, Table context c, Table context d, Table context e, Table context f, Table context g) => Table context (a, b, c, d, e, f, g) Source # | |||||||||||||
Defined in Rel8.Internal.Table Associated Types
Methods toColumns :: (a, b, c, d, e, f, g) -> Columns (a, b, c, d, e, f, g) context Source # fromColumns :: Columns (a, b, c, d, e, f, g) context -> (a, b, c, d, e, f, g) Source # fromResult :: Columns (a, b, c, d, e, f, g) Result -> FromExprs (a, b, c, d, e, f, g) Source # toResult :: FromExprs (a, b, c, d, e, f, g) -> Columns (a, b, c, d, e, f, g) Result Source # | |||||||||||||
| Sql DBType a => Table (Field table) (Field table a) Source # | |||||||||||||
Defined in Rel8.Internal.Schema.Field Associated Types
Methods toColumns :: Field table a -> Columns (Field table a) (Field table) Source # fromColumns :: Columns (Field table a) (Field table) -> Field table a Source # fromResult :: Columns (Field table a) Result -> FromExprs (Field table a) Source # toResult :: FromExprs (Field table a) -> Columns (Field table a) Result Source # | |||||||||||||
data TTable (a :: Context) b c Source #
Instances
| type Eval (TTable context a :: Constraint -> Type) Source # | |
Defined in Rel8.Internal.Table | |
data TFromExprs a b Source #
Instances
| type Eval (TFromExprs a :: Type -> Type) Source # | |
Defined in Rel8.Internal.Table | |
data TTranspose (a :: Context) b c Source #
Instances
| type Eval (TTranspose context a :: Type -> Type) Source # | |
Defined in Rel8.Internal.Table | |
data TSerialize a b c Source #
Instances
| type Eval (TSerialize expr a :: Constraint -> Type) Source # | |
Defined in Rel8.Internal.Table type Eval (TSerialize expr a :: Constraint -> Type) = (Table (Context expr) expr, a ~ FromExprs expr) | |