@@ -36,13 +36,13 @@ import GHC.TypeLits ( Symbol, KnownSymbol )
3636import Prelude
3737
3838-- rel8
39−import Rel8.Aggregate ( Aggregate )
40−import Rel8.Expr ( Expr )
39+import Rel8.Aggregate ( Aggregate, Col(..) )
40+import Rel8.Expr ( Expr, Col(..) )
4141import Rel8.Kind.Necessity
4242 ( SNecessity( SRequired, SOptional )
4343 , KnownNecessity, necessitySing
4444 )
45−import Rel8.Schema.Context
45+import Rel8.Schema.Context ( Col(..) )
4646import Rel8.Schema.Context.Identity
4747 ( fromHEitherTable, toHEitherTable
4848 , fromHListTable, toHListTable
@@ -68,7 +68,9 @@ import Rel8.Schema.HTable.Quintet ( HQuintet(..) )
6868import Rel8.Schema.HTable.These ( HTheseTable )
6969import Rel8.Schema.HTable.Trio ( HTrio(..) )
7070import Rel8.Schema.HTable.Vectorize ( hrelabel )
71+import Rel8.Schema.Insert ( Insert, Col(..) )
7172import qualified Rel8.Schema.Kind as K
73+import Rel8.Schema.Name ( Name( Name ), Col(..) )
7274import Rel8.Schema.Spec ( Spec( Spec ), KTable )
7375import Rel8.Schema.Structure
7476 ( IsStructure, Shape(..), Shape1, Shape2
@@ -114,9 +116,9 @@ instance TableHelper Expr where
114116 gtoColumns = toExprColumns
115117
116118
117−instance TableHelper Insertion where
118− gfromColumns = fromInsertionColumns
119− gtoColumns = toInsertionColumns
119+instance TableHelper Insert where
120+ gfromColumns = fromInsertColumns
121+ gtoColumns = toInsertColumns
120122
121123
122124instance TableHelper Identity where
@@ -181,8 +183,8 @@ class HTable (GRep t) => Rel8able t where
181183 fromExprColumns :: GRep t (Col Expr) -> t Expr
182184 toExprColumns :: t Expr -> GRep t (Col Expr)
183185
184− fromInsertionColumns :: GRep t (Col Insertion) -> t Insertion
185− toInsertionColumns :: t Insertion -> GRep t (Col Insertion)
186+ fromInsertColumns :: GRep t (Col Insert) -> t Insert
187+ toInsertColumns :: t Insert -> GRep t (Col Insert)
186188
187189 fromIdentityColumns :: GRep t (Col Identity) -> t Identity
188190 toIdentityColumns :: t Identity -> GRep t (Col Identity)
@@ -220,19 +222,19 @@ class HTable (GRep t) => Rel8able t where
220222 ) => t Expr -> GRep t (Col Expr)
221223 toExprColumns = toGColumns @_ @(Rep (t Structure)) . from
222224
223− default fromInsertionColumns ::
224− ( Generic (t Insertion)
225+ default fromInsertColumns ::
226+ ( Generic (t Insert)
225227 , GColumns (Rep (t Structure)) ~ GRep t
226− , GRel8able Insertion (Rep (t Structure)) (Rep (t Insertion))
227− ) => GRep t (Col Insertion) -> t Insertion
228− fromInsertionColumns = to . fromGColumns @_ @(Rep (t Structure))
228+ , GRel8able Insert (Rep (t Structure)) (Rep (t Insert))
229+ ) => GRep t (Col Insert) -> t Insert
230+ fromInsertColumns = to . fromGColumns @_ @(Rep (t Structure))
229231
230− default toInsertionColumns ::
231− ( Generic (t Insertion)
232+ default toInsertColumns ::
233+ ( Generic (t Insert)
232234 , GColumns (Rep (t Structure)) ~ GRep t
233− , GRel8able Insertion (Rep (t Structure)) (Rep (t Insertion))
234− ) => t Insertion -> GRep t (Col Insertion)
235− toInsertionColumns = toGColumns @_ @(Rep (t Structure)) . from
235+ , GRel8able Insert (Rep (t Structure)) (Rep (t Insert))
236+ ) => t Insert -> GRep t (Col Insert)
237+ toInsertColumns = toGColumns @_ @(Rep (t Structure)) . from
236238
237239 default fromIdentityColumns ::
238240 ( Generic (t Identity)
@@ -402,9 +404,9 @@ instance
402404
403405
404406instance
405− ( x ~ Field Insertion '[] necessity db a
407+ ( x ~ Field Insert '[] necessity db a
406408 , KnownNecessity necessity
407− ) => K1Table label Insertion 'True (Shape1 'Column ('Spec '[] necessity db a)) x
409+ ) => K1Table label Insert 'True (Shape1 'Column ('Spec '[] necessity db a)) x
408410 where
409411 fromK1Columns (HIdentity insert) = case insert of
410412 RequiredInsert a -> a
@@ -417,9 +419,9 @@ instance
417419
418420
419421instance
420− ( x ~ Field Insertion (label ': labels) necessity db a
422+ ( x ~ Field Insert (label ': labels) necessity db a
421423 , KnownNecessity necessity
422− ) => K1Table _label Insertion 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
424+ ) => K1Table _label Insert 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
423425 where
424426 fromK1Columns (HIdentity insert) = case insert of
425427 RequiredInsert a -> a
@@ -520,11 +522,11 @@ instance
520522instance
521523 ( HTable (K1Columns "Left" structure1)
522524 , HTable (K1Columns "Right" structure2)
523− , K1Table "Left" Insertion (IsStructure structure1) structure1 a
524− , K1Table "Right" Insertion (IsStructure structure2) structure2 b
525+ , K1Table "Left" Insert (IsStructure structure1) structure1 a
526+ , K1Table "Right" Insert (IsStructure structure2) structure2 b
525527 , e ~ EitherTable a b
526528 , KnownSymbol label
527− ) => K1Table label Insertion 'True (Shape2 'Either structure1 structure2) e
529+ ) => K1Table label Insert 'True (Shape2 'Either structure1 structure2) e
528530 where
529531 fromK1Columns =
530532 fromColumns2
@@ -615,11 +617,11 @@ instance
615617
616618
617619instance
618− ( Table Insertion a
620+ ( Table Insert a
619621 , K1Columns label structure ~ HLabel label (Columns a)
620622 , as ~ ListTable a
621623 , KnownSymbol label
622− ) => K1Table label Insertion 'True (Shape1 'List structure) as
624+ ) => K1Table label Insert 'True (Shape1 'List structure) as
623625 where
624626 fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
625627 toK1Columns = hrelabel (hlabel hlabeler) . toColumns
@@ -688,10 +690,10 @@ instance
688690
689691instance
690692 ( HTable (K1Columns "Just" structure)
691− , K1Table "Just" Insertion (IsStructure structure) structure a
693+ , K1Table "Just" Insert (IsStructure structure) structure a
692694 , ma ~ MaybeTable a
693695 , KnownSymbol label
694− ) => K1Table label Insertion 'True (Shape1 'Maybe structure) ma
696+ ) => K1Table label Insert 'True (Shape1 'Maybe structure) ma
695697 where
696698 fromK1Columns =
697699 fromColumns1 (fromK1Columns @"Just" @_ @_ @structure) .
@@ -766,11 +768,11 @@ instance
766768
767769
768770instance
769− ( Table Insertion a
771+ ( Table Insert a
770772 , K1Columns label structure ~ HLabel label (Columns a)
771773 , as ~ NonEmptyTable a
772774 , KnownSymbol label
773− ) => K1Table label Insertion 'True (Shape1 'NonEmpty structure) as
775+ ) => K1Table label Insert 'True (Shape1 'NonEmpty structure) as
774776 where
775777 fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
776778 toK1Columns = hrelabel (hlabel hlabeler) . toColumns
@@ -852,11 +854,11 @@ instance
852854instance
853855 ( HTable (K1Columns "Here" structure1)
854856 , HTable (K1Columns "There" structure2)
855− , K1Table "Here" Insertion (IsStructure structure1) structure1 a
856− , K1Table "There" Insertion (IsStructure structure2) structure2 b
857+ , K1Table "Here" Insert (IsStructure structure1) structure1 a
858+ , K1Table "There" Insert (IsStructure structure2) structure2 b
857859 , e ~ TheseTable a b
858860 , KnownSymbol label
859− ) => K1Table label Insertion 'True (Shape2 'These structure1 structure2) e
861+ ) => K1Table label Insert 'True (Shape2 'These structure1 structure2) e
860862 where
861863 fromK1Columns =
862864 fromColumns2