rel8-internal
Safe HaskellNone
LanguageHaskell2010

Rel8.Internal.Generic.Rel8able

Synopsis

Documentation

type KRel8able = Rel8able Source #

The kind of Rel8able types

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 Rel8able instances

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

Instances details
ADTable t => Rel8able (ADT t) Source # 
Instance details

Defined in Rel8.Internal.Table.ADT

Associated Types

type GColumns (ADT t) 
Instance details

Defined in Rel8.Internal.Table.ADT

type GColumns (ADT t)
type GFromExprs (ADT t) 
Instance details

Defined in Rel8.Internal.Table.ADT

type GFromExprs (ADT t) = t Result

Methods

gfromColumns :: forall (context :: Context). SContext context -> GColumns (ADT t) context -> ADT t context Source #

gtoColumns :: forall (context :: Context). SContext context -> ADT t context -> GColumns (ADT t) context Source #

gfromResult :: GColumns (ADT t) Result -> GFromExprs (ADT t) Source #

gtoResult :: GFromExprs (ADT t) -> GColumns (ADT t) Result Source #

HKDable a => Rel8able (HKD a) Source # 
Instance details

Defined in Rel8.Internal.Table.HKD

Associated Types

type GColumns (HKD a) 
Instance details

Defined in Rel8.Internal.Table.HKD

type GColumns (HKD a)
type GFromExprs (HKD a) 
Instance details

Defined in Rel8.Internal.Table.HKD

type GFromExprs (HKD a) = a

Methods

gfromColumns :: forall (context :: Context). SContext context -> GColumns (HKD a) context -> HKD a context Source #

gtoColumns :: forall (context :: Context). SContext context -> HKD a context -> GColumns (HKD a) context Source #

gfromResult :: GColumns (HKD a) Result -> GFromExprs (HKD a) Source #

gtoResult :: GFromExprs (HKD a) -> GColumns (HKD a) Result Source #

type GRep (t :: Rel8able) (context :: Context) = Rep (Record (t context)) Source #

data TSerialize a b c Source #

Instances

Instances details
type Eval (TSerialize expr a :: Constraint -> Type) Source # 
Instance details

Defined in Rel8.Internal.Generic.Rel8able

type Eval (TSerialize expr a :: Constraint -> Type)

class transposition ~ (a == Transpose Result expr) => Serialize (transposition :: Bool) expr a Source #

Minimal complete definition

serialize, deserialize

Instances

Instances details
((a == Transpose Result expr) ~ 'False, Table (Context expr) expr, FromExprs expr ~ a) => Serialize 'False expr a Source # 
Instance details

Defined in Rel8.Internal.Generic.Rel8able

Methods

serialize :: a -> Columns expr Result Source #

deserialize :: Columns expr Result -> a Source #

((a == Transpose Result expr) ~ 'True, Transposes Expr Result expr a) => Serialize 'True expr a Source # 
Instance details

Defined in Rel8.Internal.Generic.Rel8able

Methods

serialize :: a -> Columns expr Result Source #

deserialize :: Columns expr Result -> a Source #

serialize :: Serialize transposition expr a => a -> Columns expr Result Source #

deserialize :: Serialize transposition expr a => Columns expr Result -> a Source #

type family GColumns (t :: Rel8able) :: HTable Source #

Instances

Instances details
type GColumns (ADT t) Source # 
Instance details

Defined in Rel8.Internal.Table.ADT

type GColumns (ADT t)
type GColumns (HKD a) Source # 
Instance details

Defined in Rel8.Internal.Table.HKD

type GColumns (HKD a)