| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Rel8.Internal.Generic.Rel8able
Synopsis
- type KRel8able = Rel8able
- class HTable (GColumns t) => Rel8able (t :: Rel8able) where
- type GColumns (t :: Rel8able) :: HTable
- type GFromExprs (t :: Rel8able)
- gfromColumns :: forall (context :: Context). SContext context -> GColumns t context -> t context
- gtoColumns :: forall (context :: Context). SContext context -> t context -> GColumns t context
- gfromResult :: GColumns t Result -> GFromExprs t
- gtoResult :: GFromExprs t -> GColumns t Result
- type Algebra (t :: Rel8able) = GAlgebra (GRep t Expr)
- type GRep (t :: Rel8able) (context :: Context) = Rep (Record (t context))
- data TSerialize a b c
- class transposition ~ (a == Transpose Result expr) => Serialize (transposition :: Bool) expr a
- serialize :: Serialize transposition expr a => a -> Columns expr Result
- deserialize :: Serialize transposition expr a => Columns expr Result -> a
- type family GColumns (t :: Rel8able) :: HTable
Documentation
class HTable (GColumns t) => Rel8able (t :: Rel8able) where Source #
This type class allows you to define custom Tables using higher-kinded
data types. Higher-kinded data types are data types of the pattern:
data MyType f =
MyType { field1 :: Column f T1 OR HK1 f
, field2 :: Column f T2 OR HK2 f
, ...
, fieldN :: Column f Tn OR HKn f
}
where Tn is any Haskell type, and HKn is any higher-kinded type.
That is, higher-kinded data are records where all fields in the record are
all either of the type Column f T (for any T), or are themselves
higher-kinded data:
- Nested
data Nested f =
Nested { nested1 :: MyType f
, nested2 :: MyType f
}
The Rel8able type class is used to give us a special mapping operation
that lets us change the type parameter f.
- Supplying
Rel8ableinstances
This type class should be derived generically for all table types in your
project. To do this, enable the DeriveAnyClass and DeriveGeneric language
extensions:
{-# LANGUAGE DeriveAnyClass, DeriveGeneric #-}
data MyType f = MyType { fieldA :: Column f T }
deriving ( GHC.Generics.Generic, Rel8able )
Minimal complete definition
Nothing
Associated Types
type GColumns (t :: Rel8able) :: HTable Source #
type GFromExprs (t :: Rel8able) Source #
type GFromExprs (t :: Rel8able) = t Result
Methods
gfromColumns :: forall (context :: Context). SContext context -> GColumns t context -> t context Source #
default gfromColumns :: forall (context :: Context). (SRel8able t Expr, forall table. SRel8able t (Field table), SRel8able t Name, SSerialize t) => SContext context -> GColumns t context -> t context Source #
gtoColumns :: forall (context :: Context). SContext context -> t context -> GColumns t context Source #
default gtoColumns :: forall (context :: Context). (SRel8able t Expr, forall table. SRel8able t (Field table), SRel8able t Name, SSerialize t) => SContext context -> t context -> GColumns t context Source #
gfromResult :: GColumns t Result -> GFromExprs t Source #
default gfromResult :: (SSerialize t, GFromExprs t ~ t Result) => GColumns t Result -> GFromExprs t Source #
gtoResult :: GFromExprs t -> GColumns t Result Source #
default gtoResult :: (SSerialize t, GFromExprs t ~ t Result) => GFromExprs t -> GColumns t Result Source #
Instances
data TSerialize a b c Source #
Instances
| type Eval (TSerialize expr a :: Constraint -> Type) Source # | |
Defined in Rel8.Internal.Generic.Rel8able | |
class transposition ~ (a == Transpose Result expr) => Serialize (transposition :: Bool) expr a Source #
Minimal complete definition