@@ -23,6 +23,7 @@ where
2323
2424-- base
2525import Data.Bifunctor ( bimap )
26+import Data.Functor.Identity ( Identity )
2627import Data.Kind ( Constraint, Type )
2728import Data.List.NonEmpty ( NonEmpty )
2829import GHC.Generics
@@ -35,29 +36,27 @@ import GHC.TypeLits ( Symbol )
3536import Prelude
3637
3738-- rel8
39+import Rel8.Aggregate ( Aggregate )
40+import Rel8.Expr ( Expr )
3841import Rel8.Kind.Necessity
3942 ( SNecessity( SRequired, SOptional )
4043 , KnownNecessity, necessitySing
4144 )
4245import Rel8.Schema.Context
43− ( Aggregation( Aggregation )
44− , DB( DB )
45− , Insertion( RequiredInsert, OptionalInsert )
46− , Result( Result )
47− , IsSpecialContext
48− )
49−import Rel8.Schema.Context.Label ( Labelable, labeler, unlabeler )
50−import Rel8.Schema.Context.Nullify ( Nullifiable )
51−import Rel8.Schema.Context.Result
46+import Rel8.Schema.Context.Identity
5247 ( fromHEitherTable, toHEitherTable
5348 , fromHListTable, toHListTable
5449 , fromHMaybeTable, toHMaybeTable
5550 , fromHNonEmptyTable, toHNonEmptyTable
5651 , fromHTheseTable, toHTheseTable
5752 )
53+import Rel8.Schema.Context.Label
54+ ( Labelable, labeler, unlabeler
55+ , hlabeler, hunlabeler
56+ )
57+import Rel8.Schema.Context.Nullify ( Nullifiable )
5858import Rel8.Schema.Field ( Field )
5959import Rel8.Schema.HTable ( HTable )
60−import Rel8.Schema.HTable.Context ( H, HKTable )
6160import Rel8.Schema.HTable.Either ( HEitherTable )
6261import Rel8.Schema.HTable.Identity ( HIdentity(..) )
6362import Rel8.Schema.HTable.Label ( HLabel, hlabel, hunlabel )
@@ -70,8 +69,8 @@ import Rel8.Schema.HTable.Quintet ( HQuintet(..) )
7069import Rel8.Schema.HTable.These ( HTheseTable )
7170import Rel8.Schema.HTable.Trio ( HTrio(..) )
7271import Rel8.Schema.HTable.Vectorize ( hrelabel )
72+import qualified Rel8.Schema.Kind as K
7373import Rel8.Schema.Spec ( Spec( Spec ), KTable )
74−import qualified Rel8.Schema.Spec as Kind ( Context )
7574import Rel8.Schema.Structure
7675 ( IsStructure, Shape(..), Shape1, Shape2
7776 , Structure
@@ -102,22 +101,22 @@ instance (Rel8able t, TableHelper (IsSpecialContext context) context) =>
102101 toColumns = gtoColumns
103102
104103
105−type TableHelper :: Bool -> Kind.Context -> Constraint
104+type TableHelper :: Bool -> K.Context -> Constraint
106105class IsSpecialContext context ~ isSpecialContext =>
107106 TableHelper isSpecialContext context
108107 where
109− gfromColumns :: Rel8able t => GRep t (H context) -> t context
110− gtoColumns :: Rel8able t => t context -> GRep t (H context)
108+ gfromColumns :: Rel8able t => GRep t (Col context) -> t context
109+ gtoColumns :: Rel8able t => t context -> GRep t (Col context)
111110
112111
113−instance TableHelper 'True Aggregation where
114− gfromColumns = fromAggregationColumns
115− gtoColumns = toAggregationColumns
112+instance TableHelper 'True Aggregate where
113+ gfromColumns = fromAggregateColumns
114+ gtoColumns = toAggregateColumns
116115
117116
118−instance TableHelper 'True DB where
119− gfromColumns = fromDBColumns
120− gtoColumns = toDBColumns
117+instance TableHelper 'True Expr where
118+ gfromColumns = fromExprColumns
119+ gtoColumns = toExprColumns
121120
122121
123122instance TableHelper 'True Insertion where
@@ -125,9 +124,9 @@ instance TableHelper 'True Insertion where
125124 gtoColumns = toInsertionColumns
126125
127126
128−instance TableHelper 'True Result where
129− gfromColumns = fromResultColumns
130− gtoColumns = toResultColumns
127+instance TableHelper 'True Identity where
128+ gfromColumns = fromIdentityColumns
129+ gtoColumns = toIdentityColumns
131130
132131
133132instance (IsSpecialContext context ~ 'False, Labelable context, Nullifiable context) =>
@@ -139,105 +138,105 @@ instance (IsSpecialContext context ~ 'False, Labelable context, Nullifiable cont
139138
140139type Rel8able :: KTable -> Constraint
141140class HTable (GRep t) => Rel8able t where
142− type GRep t :: HKTable
141+ type GRep t :: K.HTable
143142
144− fromAggregationColumns :: GRep t (H Aggregation) -> t Aggregation
145− toAggregationColumns :: t Aggregation -> GRep t (H Aggregation)
143+ fromAggregateColumns :: GRep t (Col Aggregate) -> t Aggregate
144+ toAggregateColumns :: t Aggregate -> GRep t (Col Aggregate)
146145
147− fromDBColumns :: GRep t (H DB) -> t DB
148− toDBColumns :: t DB -> GRep t (H DB)
146+ fromExprColumns :: GRep t (Col Expr) -> t Expr
147+ toExprColumns :: t Expr -> GRep t (Col Expr)
149148
150− fromInsertionColumns :: GRep t (H Insertion) -> t Insertion
151− toInsertionColumns :: t Insertion -> GRep t (H Insertion)
149+ fromInsertionColumns :: GRep t (Col Insertion) -> t Insertion
150+ toInsertionColumns :: t Insertion -> GRep t (Col Insertion)
152151
153− fromResultColumns :: GRep t (H Result) -> t Result
154− toResultColumns :: t Result -> GRep t (H Result)
152+ fromIdentityColumns :: GRep t (Col Identity) -> t Identity
153+ toIdentityColumns :: t Identity -> GRep t (Col Identity)
155154
156155 fromUnspecialColumns ::
157156 ( IsSpecialContext context ~ 'False
158157 , Labelable context, Nullifiable context
159158 )
160− => GRep t (H context) -> t context
159+ => GRep t (Col context) -> t context
161160 toUnspecialColumns ::
162161 ( IsSpecialContext context ~ 'False
163162 , Labelable context, Nullifiable context
164163 )
165− => t context -> GRep t (H context)
164+ => t context -> GRep t (Col context)
166165
167166 type GRep t = GColumns (Rep (t Structure))
168167
169− default fromAggregationColumns ::
170− ( Generic (t Aggregation)
168+ default fromAggregateColumns ::
169+ ( Generic (t Aggregate)
171170 , GColumns (Rep (t Structure)) ~ GRep t
172− , GRel8able Aggregation (Rep (t Structure)) (Rep (t Aggregation))
173− ) => GRep t (H Aggregation) -> t Aggregation
174− fromAggregationColumns = to . fromGColumns @_ @(Rep (t Structure))
171+ , GRel8able Aggregate (Rep (t Structure)) (Rep (t Aggregate))
172+ ) => GRep t (Col Aggregate) -> t Aggregate
173+ fromAggregateColumns = to . fromGColumns @_ @(Rep (t Structure))
175174
176− default toAggregationColumns ::
177− ( Generic (t Aggregation)
175+ default toAggregateColumns ::
176+ ( Generic (t Aggregate)
178177 , GColumns (Rep (t Structure)) ~ GRep t
179− , GRel8able Aggregation (Rep (t Structure)) (Rep (t Aggregation))
180− ) => t Aggregation -> GRep t (H Aggregation)
181− toAggregationColumns = toGColumns @_ @(Rep (t Structure)) . from
178+ , GRel8able Aggregate (Rep (t Structure)) (Rep (t Aggregate))
179+ ) => t Aggregate -> GRep t (Col Aggregate)
180+ toAggregateColumns = toGColumns @_ @(Rep (t Structure)) . from
182181
183− default fromDBColumns ::
184− ( Generic (t DB)
182+ default fromExprColumns ::
183+ ( Generic (t Expr)
185184 , GColumns (Rep (t Structure)) ~ GRep t
186− , GRel8able DB (Rep (t Structure)) (Rep (t DB))
187− ) => GRep t (H DB) -> t DB
188− fromDBColumns = to . fromGColumns @_ @(Rep (t Structure))
185+ , GRel8able Expr (Rep (t Structure)) (Rep (t Expr))
186+ ) => GRep t (Col Expr) -> t Expr
187+ fromExprColumns = to . fromGColumns @_ @(Rep (t Structure))
189188
190− default toDBColumns ::
191− ( Generic (t DB)
189+ default toExprColumns ::
190+ ( Generic (t Expr)
192191 , GColumns (Rep (t Structure)) ~ GRep t
193− , GRel8able DB (Rep (t Structure)) (Rep (t DB))
194− ) => t DB -> GRep t (H DB)
195− toDBColumns = toGColumns @_ @(Rep (t Structure)) . from
192+ , GRel8able Expr (Rep (t Structure)) (Rep (t Expr))
193+ ) => t Expr -> GRep t (Col Expr)
194+ toExprColumns = toGColumns @_ @(Rep (t Structure)) . from
196195
197196 default fromInsertionColumns ::
198197 ( Generic (t Insertion)
199198 , GColumns (Rep (t Structure)) ~ GRep t
200199 , GRel8able Insertion (Rep (t Structure)) (Rep (t Insertion))
201− ) => GRep t (H Insertion) -> t Insertion
200+ ) => GRep t (Col Insertion) -> t Insertion
202201 fromInsertionColumns = to . fromGColumns @_ @(Rep (t Structure))
203202
204203 default toInsertionColumns ::
205204 ( Generic (t Insertion)
206205 , GColumns (Rep (t Structure)) ~ GRep t
207206 , GRel8able Insertion (Rep (t Structure)) (Rep (t Insertion))
208− ) => t Insertion -> GRep t (H Insertion)
207+ ) => t Insertion -> GRep t (Col Insertion)
209208 toInsertionColumns = toGColumns @_ @(Rep (t Structure)) . from
210209
211− default fromResultColumns ::
212− ( Generic (t Result)
210+ default fromIdentityColumns ::
211+ ( Generic (t Identity)
213212 , GColumns (Rep (t Structure)) ~ GRep t
214− , GRel8able Result (Rep (t Structure)) (Rep (t Result))
215− ) => GRep t (H Result) -> t Result
216− fromResultColumns = to . fromGColumns @_ @(Rep (t Structure))
213+ , GRel8able Identity (Rep (t Structure)) (Rep (t Identity))
214+ ) => GRep t (Col Identity) -> t Identity
215+ fromIdentityColumns = to . fromGColumns @_ @(Rep (t Structure))
217216
218− default toResultColumns ::
219− ( Generic (t Result)
217+ default toIdentityColumns ::
218+ ( Generic (t Identity)
220219 , GColumns (Rep (t Structure)) ~ GRep t
221− , GRel8able Result (Rep (t Structure)) (Rep (t Result))
222− ) => t Result -> GRep t (H Result)
223− toResultColumns = toGColumns @_ @(Rep (t Structure)) . from
220+ , GRel8able Identity (Rep (t Structure)) (Rep (t Identity))
221+ ) => t Identity -> GRep t (Col Identity)
222+ toIdentityColumns = toGColumns @_ @(Rep (t Structure)) . from
224223
225224 default fromUnspecialColumns ::
226225 ( Generic (t context)
227226 , GColumns (Rep (t Structure)) ~ GRep t
228227 , GRel8able context (Rep (t Structure)) (Rep (t context))
229− ) => GRep t (H context) -> t context
228+ ) => GRep t (Col context) -> t context
230229 fromUnspecialColumns = to . fromGColumns @_ @(Rep (t Structure))
231230
232231 default toUnspecialColumns ::
233232 ( Generic (t context)
234233 , GColumns (Rep (t Structure)) ~ GRep t
235234 , GRel8able context (Rep (t Structure)) (Rep (t context))
236− ) => t context -> GRep t (H context)
235+ ) => t context -> GRep t (Col context)
237236 toUnspecialColumns = toGColumns @_ @(Rep (t Structure)) . from
238237
239238
240−type GColumns :: (Type -> Type) -> HKTable
239+type GColumns :: (Type -> Type) -> K.HTable
241240type family GColumns structure where
242241 GColumns (M1 D _ structure) = GColumns structure
243242 GColumns (M1 C _ structure) = GColumns structure
@@ -246,10 +245,10 @@ type family GColumns structure where
246245 K1Columns label structure
247246
248247
249−type GRel8able :: Kind.Context -> (Type -> Type) -> (Type -> Type) -> Constraint
248+type GRel8able :: K.Context -> (Type -> Type) -> (Type -> Type) -> Constraint
250249class GRel8able context structure rep where
251− fromGColumns :: GColumns structure (H context) -> rep x
252− toGColumns :: rep x -> GColumns structure (H context)
250+ fromGColumns :: GColumns structure (Col context) -> rep x
251+ toGColumns :: rep x -> GColumns structure (Col context)
253252
254253
255254instance GRel8able context structure rep => GRel8able context (M1 D c structure) (M1 D c rep) where
@@ -285,7 +284,7 @@ instance
285284 toGColumns (M1 (K1 a)) = toK1Columns @label @_ @_ @_ @structure a
286285
287286
288−type K1Columns :: Symbol -> Type -> HKTable
287+type K1Columns :: Symbol -> Type -> K.HTable
289288type family K1Columns label structure where
290289 K1Columns label (Shape1 'Column ('Spec '[] necessity nullability blueprint)) =
291290 HIdentity ('Spec '[label] necessity nullability blueprint)
@@ -327,19 +326,19 @@ type family K1Columns label structure where
327326 K1Columns label a = HLabel label (Columns a)
328327
329328
330−type K1Table :: Symbol -> Bool -> Kind.Context -> Bool -> Type -> Type -> Constraint
329+type K1Table :: Symbol -> Bool -> K.Context -> Bool -> Type -> Type -> Constraint
331330class
332331 ( isSpecialContext ~ IsSpecialContext context
333332 , isStructure ~ IsStructure structure
334333 ) => K1Table label isSpecialContext context isStructure structure a
335334 where
336− fromK1Columns :: K1Columns label structure (H context) -> a
337− toK1Columns :: a -> K1Columns label structure (H context)
335+ fromK1Columns :: K1Columns label structure (Col context) -> a
336+ toK1Columns :: a -> K1Columns label structure (Col context)
338337
339338
340339instance
341− ( x ~ Field Aggregation '[] necessity db a
342− ) => K1Table label 'True Aggregation 'True (Shape1 'Column ('Spec '[] necessity db a)) x
340+ ( x ~ Field Aggregate '[] necessity db a
341+ ) => K1Table label 'True Aggregate 'True (Shape1 'Column ('Spec '[] necessity db a)) x
343342 where
344343 fromK1Columns (HIdentity (Aggregation a)) = a
345344 toK1Columns = HIdentity . Aggregation
@@ -348,8 +347,8 @@ instance
348347
349348
350349instance
351− ( x ~ Field Aggregation (label ': labels) necessity db a
352− ) => K1Table _label 'True Aggregation 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
350+ ( x ~ Field Aggregate (label ': labels) necessity db a
351+ ) => K1Table _label 'True Aggregate 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
353352 where
354353 fromK1Columns (HIdentity (Aggregation a)) = a
355354 toK1Columns = HIdentity . Aggregation
@@ -358,8 +357,8 @@ instance
358357
359358
360359instance
361− ( x ~ Field DB '[] necessity db a
362− ) => K1Table label 'True DB 'True (Shape1 'Column ('Spec '[] necessity db a)) x
360+ ( x ~ Field Expr '[] necessity db a
361+ ) => K1Table label 'True Expr 'True (Shape1 'Column ('Spec '[] necessity db a)) x
363362 where
364363 fromK1Columns (HIdentity (DB a)) = a
365364 toK1Columns = HIdentity . DB
@@ -368,8 +367,8 @@ instance
368367
369368
370369instance
371− ( x ~ Field DB (label ': labels) necessity db a
372− ) => K1Table _label 'True DB 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
370+ ( x ~ Field Expr (label ': labels) necessity db a
371+ ) => K1Table _label 'True Expr 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
373372 where
374373 fromK1Columns (HIdentity (DB a)) = a
375374 toK1Columns = HIdentity . DB
@@ -408,8 +407,8 @@ instance
408407
409408
410409instance
411− ( x ~ Field Result '[] necessity db a
412− ) => K1Table label 'True Result 'True (Shape1 'Column ('Spec '[] necessity db a)) x
410+ ( x ~ Field Identity '[] necessity db a
411+ ) => K1Table label 'True Identity 'True (Shape1 'Column ('Spec '[] necessity db a)) x
413412 where
414413 fromK1Columns (HIdentity (Result a)) = a
415414 toK1Columns = HIdentity . Result
@@ -418,8 +417,8 @@ instance
418417
419418
420419instance
421− ( x ~ Field Result (label ': labels) necessity db a
422− ) => K1Table _label 'True Result 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
420+ ( x ~ Field Identity (label ': labels) necessity db a
421+ ) => K1Table _label 'True Identity 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
423422 where
424423 fromK1Columns (HIdentity (Result a)) = a
425424 toK1Columns = HIdentity . Result
@@ -429,23 +428,23 @@ instance
429428
430429instance
431430 ( IsSpecialContext context ~ 'False
432− , x ~ context ('Spec (label ': labels) necessity db a)
431+ , x ~ context a
433432 ) => K1Table _label 'False context 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
434433 where
435− fromK1Columns = unHIdentity
436− toK1Columns = HIdentity
434+ fromK1Columns (HIdentity (Col a)) = a
435+ toK1Columns = HIdentity . Col
437436 {-# INLINABLE fromK1Columns #-}
438437 {-# INLINABLE toK1Columns #-}
439438
440439
441440instance
442441 ( IsSpecialContext context ~ 'False
443− , x ~ context ('Spec '[] necessity db a)
442+ , x ~ context a
444443 , Labelable context
445444 ) => K1Table label 'False context 'True (Shape1 'Column ('Spec '[] necessity db a)) x
446445 where
447− fromK1Columns = unlabeler . unHIdentity
448− toK1Columns = HIdentity . labeler
446+ fromK1Columns = (\(Col a) -> a) . unlabeler . unHIdentity
447+ toK1Columns = HIdentity . labeler . Col
449448 {-# INLINABLE fromK1Columns #-}
450449 {-# INLINABLE toK1Columns #-}
451450
@@ -453,10 +452,10 @@ instance
453452instance
454453 ( HTable (K1Columns "Left" structure1)
455454 , HTable (K1Columns "Right" structure2)
456− , K1Table "Left" 'True Aggregation (IsStructure structure1) structure1 a
457− , K1Table "Right" 'True Aggregation (IsStructure structure2) structure2 b
455+ , K1Table "Left" 'True Aggregate (IsStructure structure1) structure1 a
456+ , K1Table "Right" 'True Aggregate (IsStructure structure2) structure2 b
458457 , e ~ EitherTable a b
459− ) => K1Table label 'True Aggregation 'True (Shape2 'Either structure1 structure2) e
458+ ) => K1Table label 'True Aggregate 'True (Shape2 'Either structure1 structure2) e
460459 where
461460 fromK1Columns =
462461 fromColumns2
@@ -475,10 +474,10 @@ instance
475474instance
476475 ( HTable (K1Columns "Left" structure1)
477476 , HTable (K1Columns "Right" structure2)
478− , K1Table "Left" 'True DB (IsStructure structure1) structure1 a
479− , K1Table "Right" 'True DB (IsStructure structure2) structure2 b
477+ , K1Table "Left" 'True Expr (IsStructure structure1) structure1 a
478+ , K1Table "Right" 'True Expr (IsStructure structure2) structure2 b
480479 , e ~ EitherTable a b
481− ) => K1Table label 'True DB 'True (Shape2 'Either structure1 structure2) e
480+ ) => K1Table label 'True Expr 'True (Shape2 'Either structure1 structure2) e
482481 where
483482 fromK1Columns =
484483 fromColumns2
@@ -519,10 +518,10 @@ instance
519518instance
520519 ( HTable (K1Columns "Left" structure1)
521520 , HTable (K1Columns "Right" structure2)
522− , K1Table "Left" 'True Result (IsStructure structure1) structure1 a
523− , K1Table "Right" 'True Result (IsStructure structure2) structure2 b
521+ , K1Table "Left" 'True Identity (IsStructure structure1) structure1 a
522+ , K1Table "Right" 'True Identity (IsStructure structure2) structure2 b
524523 , e ~ Either a b
525− ) => K1Table label 'True Result 'True (Shape2 'Either structure1 structure2) e
524+ ) => K1Table label 'True Identity 'True (Shape2 'Either structure1 structure2) e
526525 where
527526 fromK1Columns
528527 = bimap
@@ -566,27 +565,27 @@ instance
566565
567566
568567instance
569− ( K1Table label 'True Aggregation (IsStructure structure) structure a
570− , Table Aggregation a
568+ ( K1Table label 'True Aggregate (IsStructure structure) structure a
569+ , Table Aggregate a
571570 , K1Columns label structure ~ HLabel label (Columns a)
572571 , as ~ ListTable a
573− ) => K1Table label 'True Aggregation 'True (Shape1 'List structure) as
572+ ) => K1Table label 'True Aggregate 'True (Shape1 'List structure) as
574573 where
575− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
576− toK1Columns = hrelabel (hlabel labeler) . toColumns
574+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
575+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
577576 {-# INLINABLE fromK1Columns #-}
578577 {-# INLINABLE toK1Columns #-}
579578
580579
581580instance
582− ( K1Table label 'True DB (IsStructure structure) structure a
583− , Table DB a
581+ ( K1Table label 'True Expr (IsStructure structure) structure a
582+ , Table Expr a
584583 , K1Columns label structure ~ HLabel label (Columns a)
585584 , as ~ ListTable a
586− ) => K1Table label 'True DB 'True (Shape1 'List structure) as
585+ ) => K1Table label 'True Expr 'True (Shape1 'List structure) as
587586 where
588− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
589− toK1Columns = hrelabel (hlabel labeler) . toColumns
587+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
588+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
590589 {-# INLINABLE fromK1Columns #-}
591590 {-# INLINABLE toK1Columns #-}
592591
@@ -598,20 +597,20 @@ instance
598597 , as ~ ListTable a
599598 ) => K1Table label 'True Insertion 'True (Shape1 'List structure) as
600599 where
601− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
602− toK1Columns = hrelabel (hlabel labeler) . toColumns
600+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
601+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
603602 {-# INLINABLE fromK1Columns #-}
604603 {-# INLINABLE toK1Columns #-}
605604
606605
607606instance
608− ( K1Table label 'True Result (IsStructure structure) structure a
607+ ( K1Table label 'True Identity (IsStructure structure) structure a
609608 , HTable (K1Columns label structure)
610609 , as ~ [a]
611− ) => K1Table label 'True Result 'True (Shape1 'List structure) as
610+ ) => K1Table label 'True Identity 'True (Shape1 'List structure) as
612611 where
613− fromK1Columns = fmap (fromK1Columns @label @'True @Result @_ @structure) . fromHListTable
614− toK1Columns = toHListTable . fmap (toK1Columns @label @'True @Result @_ @structure)
612+ fromK1Columns = fmap (fromK1Columns @label @'True @Identity @_ @structure) . fromHListTable
613+ toK1Columns = toHListTable . fmap (toK1Columns @label @'True @Identity @_ @structure)
615614 {-# INLINABLE fromK1Columns #-}
616615 {-# INLINABLE toK1Columns #-}
617616
@@ -625,23 +624,23 @@ instance
625624 , as ~ ListTable a
626625 ) => K1Table label 'False context 'True (Shape1 'List structure) as
627626 where
628− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
629− toK1Columns = hrelabel (hlabel labeler) . toColumns
627+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
628+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
630629 {-# INLINABLE fromK1Columns #-}
631630 {-# INLINABLE toK1Columns #-}
632631
633632
634633instance
635634 ( HTable (K1Columns "Just" structure)
636− , K1Table "Just" 'True Aggregation (IsStructure structure) structure a
635+ , K1Table "Just" 'True Aggregate (IsStructure structure) structure a
637636 , ma ~ MaybeTable a
638− ) => K1Table label 'True Aggregation 'True (Shape1 'Maybe structure) ma
637+ ) => K1Table label 'True Aggregate 'True (Shape1 'Maybe structure) ma
639638 where
640639 fromK1Columns =
641640 fromColumns1 (fromK1Columns @"Just" @_ @_ @_ @structure) .
642− hunlabel unlabeler
641+ hunlabel hunlabeler
643642 toK1Columns =
644− hlabel labeler .
643+ hlabel hlabeler .
645644 toColumns1 (toK1Columns @"Just" @_ @_ @_ @structure)
646645 {-# INLINABLE fromK1Columns #-}
647646 {-# INLINABLE toK1Columns #-}
@@ -649,15 +648,15 @@ instance
649648
650649instance
651650 ( HTable (K1Columns "Just" structure)
652− , K1Table "Just" 'True DB (IsStructure structure) structure a
651+ , K1Table "Just" 'True Expr (IsStructure structure) structure a
653652 , ma ~ MaybeTable a
654− ) => K1Table label 'True DB 'True (Shape1 'Maybe structure) ma
653+ ) => K1Table label 'True Expr 'True (Shape1 'Maybe structure) ma
655654 where
656655 fromK1Columns =
657656 fromColumns1 (fromK1Columns @"Just" @_ @_ @_ @structure) .
658− hunlabel unlabeler
657+ hunlabel hunlabeler
659658 toK1Columns =
660− hlabel labeler .
659+ hlabel hlabeler .
661660 toColumns1 (toK1Columns @"Just" @_ @_ @_ @structure)
662661 {-# INLINABLE fromK1Columns #-}
663662 {-# INLINABLE toK1Columns #-}
@@ -671,9 +670,9 @@ instance
671670 where
672671 fromK1Columns =
673672 fromColumns1 (fromK1Columns @"Just" @_ @_ @_ @structure) .
674− hunlabel unlabeler
673+ hunlabel hunlabeler
675674 toK1Columns =
676− hlabel labeler .
675+ hlabel hlabeler .
677676 toColumns1 (toK1Columns @"Just" @_ @_ @_ @structure)
678677 {-# INLINABLE fromK1Columns #-}
679678 {-# INLINABLE toK1Columns #-}
@@ -681,9 +680,9 @@ instance
681680
682681instance
683682 ( HTable (K1Columns "Just" structure)
684− , K1Table "Just" 'True Result (IsStructure structure) structure a
683+ , K1Table "Just" 'True Identity (IsStructure structure) structure a
685684 , ma ~ Maybe a
686− ) => K1Table label 'True Result 'True (Shape1 'Maybe structure) ma
685+ ) => K1Table label 'True Identity 'True (Shape1 'Maybe structure) ma
687686 where
688687 fromK1Columns
689688 = fmap (fromK1Columns @"Just" @_ @_ @_ @structure)
@@ -717,27 +716,27 @@ instance
717716
718717
719718instance
720− ( K1Table label 'True Aggregation (IsStructure structure) structure a
721− , Table Aggregation a
719+ ( K1Table label 'True Aggregate (IsStructure structure) structure a
720+ , Table Aggregate a
722721 , K1Columns label structure ~ HLabel label (Columns a)
723722 , as ~ NonEmptyTable a
724− ) => K1Table label 'True Aggregation 'True (Shape1 'NonEmpty structure) as
723+ ) => K1Table label 'True Aggregate 'True (Shape1 'NonEmpty structure) as
725724 where
726− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
727− toK1Columns = hrelabel (hlabel labeler) . toColumns
725+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
726+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
728727 {-# INLINABLE fromK1Columns #-}
729728 {-# INLINABLE toK1Columns #-}
730729
731730
732731instance
733− ( K1Table label 'True DB (IsStructure structure) structure a
734− , Table DB a
732+ ( K1Table label 'True Expr (IsStructure structure) structure a
733+ , Table Expr a
735734 , K1Columns label structure ~ HLabel label (Columns a)
736735 , as ~ NonEmptyTable a
737− ) => K1Table label 'True DB 'True (Shape1 'NonEmpty structure) as
736+ ) => K1Table label 'True Expr 'True (Shape1 'NonEmpty structure) as
738737 where
739− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
740− toK1Columns = hrelabel (hlabel labeler) . toColumns
738+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
739+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
741740 {-# INLINABLE fromK1Columns #-}
742741 {-# INLINABLE toK1Columns #-}
743742
@@ -749,20 +748,20 @@ instance
749748 , as ~ NonEmptyTable a
750749 ) => K1Table label 'True Insertion 'True (Shape1 'NonEmpty structure) as
751750 where
752− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
753− toK1Columns = hrelabel (hlabel labeler) . toColumns
751+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
752+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
754753 {-# INLINABLE fromK1Columns #-}
755754 {-# INLINABLE toK1Columns #-}
756755
757756
758757instance
759− ( K1Table label 'True Result (IsStructure structure) structure a
758+ ( K1Table label 'True Identity (IsStructure structure) structure a
760759 , HTable (K1Columns label structure)
761760 , as ~ NonEmpty a
762− ) => K1Table label 'True Result 'True (Shape1 'NonEmpty structure) as
761+ ) => K1Table label 'True Identity 'True (Shape1 'NonEmpty structure) as
763762 where
764− fromK1Columns = fmap (fromK1Columns @label @'True @Result @_ @structure) . fromHNonEmptyTable
765− toK1Columns = toHNonEmptyTable . fmap (toK1Columns @label @'True @Result @_ @structure)
763+ fromK1Columns = fmap (fromK1Columns @label @'True @Identity @_ @structure) . fromHNonEmptyTable
764+ toK1Columns = toHNonEmptyTable . fmap (toK1Columns @label @'True @Identity @_ @structure)
766765 {-# INLINABLE fromK1Columns #-}
767766 {-# INLINABLE toK1Columns #-}
768767
@@ -776,8 +775,8 @@ instance
776775 , as ~ NonEmptyTable a
777776 ) => K1Table label 'False context 'True (Shape1 'NonEmpty structure) as
778777 where
779− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
780− toK1Columns = hrelabel (hlabel labeler) . toColumns
778+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
779+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
781780 {-# INLINABLE fromK1Columns #-}
782781 {-# INLINABLE toK1Columns #-}
783782
@@ -785,10 +784,10 @@ instance
785784instance
786785 ( HTable (K1Columns "Here" structure1)
787786 , HTable (K1Columns "There" structure2)
788− , K1Table "Here" 'True Aggregation (IsStructure structure1) structure1 a
789− , K1Table "There" 'True Aggregation (IsStructure structure2) structure2 b
787+ , K1Table "Here" 'True Aggregate (IsStructure structure1) structure1 a
788+ , K1Table "There" 'True Aggregate (IsStructure structure2) structure2 b
790789 , e ~ TheseTable a b
791− ) => K1Table label 'True Aggregation 'True (Shape2 'These structure1 structure2) e
790+ ) => K1Table label 'True Aggregate 'True (Shape2 'These structure1 structure2) e
792791 where
793792 fromK1Columns =
794793 fromColumns2
@@ -807,10 +806,10 @@ instance
807806instance
808807 ( HTable (K1Columns "Here" structure1)
809808 , HTable (K1Columns "There" structure2)
810− , K1Table "Here" 'True DB (IsStructure structure1) structure1 a
811− , K1Table "There" 'True DB (IsStructure structure2) structure2 b
809+ , K1Table "Here" 'True Expr (IsStructure structure1) structure1 a
810+ , K1Table "There" 'True Expr (IsStructure structure2) structure2 b
812811 , e ~ TheseTable a b
813− ) => K1Table label 'True DB 'True (Shape2 'These structure1 structure2) e
812+ ) => K1Table label 'True Expr 'True (Shape2 'These structure1 structure2) e
814813 where
815814 fromK1Columns =
816815 fromColumns2
@@ -851,10 +850,10 @@ instance
851850instance
852851 ( HTable (K1Columns "Here" structure1)
853852 , HTable (K1Columns "There" structure2)
854− , K1Table "Here" 'True Result (IsStructure structure1) structure1 a
855− , K1Table "There" 'True Result (IsStructure structure2) structure2 b
853+ , K1Table "Here" 'True Identity (IsStructure structure1) structure1 a
854+ , K1Table "There" 'True Identity (IsStructure structure2) structure2 b
856855 , e ~ These a b
857− ) => K1Table label 'True Result 'True (Shape2 'These structure1 structure2) e
856+ ) => K1Table label 'True Identity 'True (Shape2 'These structure1 structure2) e
858857 where
859858 fromK1Columns
860859 = bimap