Add and export KRel8able

This commit is contained in:
Oliver Charles 2021-04-16 13:25:52 +01:00
parent 04fdf2732d
commit 242dc79996
2 changed files with 7 additions and 2 deletions

View File

@ -26,7 +26,7 @@ module Rel8
, DBFractional , DBFractional
-- * Tables and higher-kinded tables -- * Tables and higher-kinded tables
, Rel8able , Rel8able, KRel8able
, Column, Field, Necessity( Required, Optional ) , Column, Field, Necessity( Required, Optional )
, Default , Default
, HMaybe , HMaybe

View File

@ -18,6 +18,7 @@
module Rel8.Schema.Generic module Rel8.Schema.Generic
( Rel8able ( Rel8able
, KRel8able
) )
where where
@ -61,6 +62,10 @@ instance
toColumns = hunreify . gtoColumns . reify toColumns = hunreify . gtoColumns . reify
type KRel8able :: Type
type KRel8able = K.Table
-- | This type class allows you to define custom 'Table's using higher-kinded -- | This type class allows you to define custom 'Table's using higher-kinded
-- data types. Higher-kinded data types are data types of the pattern: -- data types. Higher-kinded data types are data types of the pattern:
-- --
@ -103,7 +108,7 @@ instance
-- data MyType f = MyType { fieldA :: Column f T } -- data MyType f = MyType { fieldA :: Column f T }
-- deriving ( GHC.Generics.Generic, Rel8able ) -- deriving ( GHC.Generics.Generic, Rel8able )
-- @ -- @
type Rel8able :: K.Table -> Constraint type Rel8able :: KRel8able -> Constraint
class HTable (GRep t) => Rel8able t where class HTable (GRep t) => Rel8able t where
gfromColumns :: (Labelable context, Reifiable context) gfromColumns :: (Labelable context, Reifiable context)
=> GRep t (Col (Reify context)) -> t (Reify context) => GRep t (Col (Reify context)) -> t (Reify context)