@@ -42,6 +42,7 @@ import Rel8.Schema.HTable ( HTable )
4242import Rel8.Schema.HTable.Label ( HLabel, hlabel, hunlabel )
4343import Rel8.Schema.HTable.Pair ( HPair(..) )
4444import qualified Rel8.Schema.Kind as K
45+import Rel8.Schema.Name ( Name )
4546import Rel8.Schema.Spec ( KTable )
4647import Rel8.Table
4748 ( Table, Columns, Context, fromColumns, toColumns
@@ -52,10 +53,9 @@ instance
5253 ( Rel8able t
5354 , Labelable context
5455 , Reifiable context
55− , HTable (GRep context t)
5656 ) => Table context (t context)
5757 where
58− type Columns (t context) = GRep context t
58+ type Columns (t context) = GRep t
5959 type Context (t context) = context
6060
6161 fromColumns = unreify . gfromColumns . hreify
@@ -105,28 +105,30 @@ instance
105105-- deriving ( GHC.Generics.Generic, Rel8able )
106106-- @
107107type Rel8able :: KTable -> Constraint
108−class Rel8able t where
108+class HTable (GRep t) => Rel8able t where
109109 gfromColumns :: (Labelable context, Reifiable context)
110− => GRep context t (Col (Reify context)) -> t (Reify context)
110+ => GRep t (Col (Reify context)) -> t (Reify context)
111111
112112 gtoColumns :: (Labelable context, Reifiable context)
113− => t (Reify context) -> GRep context t (Col (Reify context))
113+ => t (Reify context) -> GRep t (Col (Reify context))
114114
115115 default gfromColumns :: forall context.
116116 ( Generic (t (Reify context))
117+ , GColumns (Rep (t (Reify context))) ~ GRep t
117118 , GRel8able context (Rep (t (Reify context)))
118− ) => GRep context t (Col (Reify context)) -> t (Reify context)
119+ ) => GRep t (Col (Reify context)) -> t (Reify context)
119120 gfromColumns = to . fromGColumns @_ @(Rep (t (Reify context)))
120121
121122 default gtoColumns :: forall context.
122123 ( Generic (t (Reify context))
124+ , GColumns (Rep (t (Reify context))) ~ GRep t
123125 , GRel8able context (Rep (t (Reify context)))
124− ) => t (Reify context) -> GRep context t (Col (Reify context))
126+ ) => t (Reify context) -> GRep t (Col (Reify context))
125127 gtoColumns = toGColumns @_ @(Rep (t (Reify context))) . from
126128
127129
128−type GRep :: K.Context -> K.Table -> K.HTable
129−type GRep context t = GColumns (Rep (t (Reify context)))
130+type GRep :: K.Table -> K.HTable
131+type GRep t = GColumns (Rep (t (Reify Name)))
130132
131133
132134type GColumns :: (Type -> Type) -> K.HTable