@@ -23,6 +23,7 @@ where
25import Data.Bifunctor ( bimap )
25import Data.Bifunctor ( bimap )
26+import Data.Functor.Identity ( Identity )
26import Data.Kind ( Constraint, Type )
27import Data.Kind ( Constraint, Type )
27import Data.List.NonEmpty ( NonEmpty )
28import Data.List.NonEmpty ( NonEmpty )
28import GHC.Generics
29import GHC.Generics
@@ -35,29 +36,27 @@ import GHC.TypeLits ( Symbol )
35import Prelude
36import Prelude
39+import Rel8.Aggregate ( Aggregate )
40+import Rel8.Expr ( Expr )
38import Rel8.Kind.Necessity
41import Rel8.Kind.Necessity
39 ( SNecessity( SRequired, SOptional )
42 ( SNecessity( SRequired, SOptional )
40 , KnownNecessity, necessitySing
43 , KnownNecessity, necessitySing
42import Rel8.Schema.Context
45import Rel8.Schema.Context
43− ( Aggregation( Aggregation )
45− , Insertion( RequiredInsert, OptionalInsert )
49−import Rel8.Schema.Context.Label ( Labelable, labeler, unlabeler )
46+import Rel8.Schema.Context.Identity
50−import Rel8.Schema.Context.Nullify ( Nullifiable )
51−import Rel8.Schema.Context.Result
52 ( fromHEitherTable, toHEitherTable
47 ( fromHEitherTable, toHEitherTable
53 , fromHListTable, toHListTable
48 , fromHListTable, toHListTable
54 , fromHMaybeTable, toHMaybeTable
49 , fromHMaybeTable, toHMaybeTable
55 , fromHNonEmptyTable, toHNonEmptyTable
50 , fromHNonEmptyTable, toHNonEmptyTable
56 , fromHTheseTable, toHTheseTable
51 , fromHTheseTable, toHTheseTable
53+import Rel8.Schema.Context.Label
54+ ( Labelable, labeler, unlabeler
55+ , hlabeler, hunlabeler
57+import Rel8.Schema.Context.Nullify ( Nullifiable )
58import Rel8.Schema.Field ( Field )
58import Rel8.Schema.Field ( Field )
59import Rel8.Schema.HTable ( HTable )
59import Rel8.Schema.HTable ( HTable )
60−import Rel8.Schema.HTable.Context ( H, HKTable )
61import Rel8.Schema.HTable.Either ( HEitherTable )
60import Rel8.Schema.HTable.Either ( HEitherTable )
62import Rel8.Schema.HTable.Identity ( HIdentity(..) )
61import Rel8.Schema.HTable.Identity ( HIdentity(..) )
63import Rel8.Schema.HTable.Label ( HLabel, hlabel, hunlabel )
62import Rel8.Schema.HTable.Label ( HLabel, hlabel, hunlabel )
@@ -70,8 +69,8 @@ import Rel8.Schema.HTable.Quintet ( HQuintet(..) )
70import Rel8.Schema.HTable.These ( HTheseTable )
69import Rel8.Schema.HTable.These ( HTheseTable )
71import Rel8.Schema.HTable.Trio ( HTrio(..) )
70import Rel8.Schema.HTable.Trio ( HTrio(..) )
72import Rel8.Schema.HTable.Vectorize ( hrelabel )
71import Rel8.Schema.HTable.Vectorize ( hrelabel )
72+import qualified Rel8.Schema.Kind as K
73import Rel8.Schema.Spec ( Spec( Spec ), KTable )
73import Rel8.Schema.Spec ( Spec( Spec ), KTable )
74−import qualified Rel8.Schema.Spec as Kind ( Context )
75import Rel8.Schema.Structure
74import Rel8.Schema.Structure
76 ( IsStructure, Shape(..), Shape1, Shape2
75 ( IsStructure, Shape(..), Shape1, Shape2
77 , Structure
76 , Structure
@@ -102,22 +101,22 @@ instance (Rel8able t, TableHelper (IsSpecialContext context) context) =>
102 toColumns = gtoColumns
101 toColumns = gtoColumns
105−type TableHelper :: Bool -> Kind.Context -> Constraint
104+type TableHelper :: Bool -> K.Context -> Constraint
106class IsSpecialContext context ~ isSpecialContext =>
105class IsSpecialContext context ~ isSpecialContext =>
107 TableHelper isSpecialContext context
106 TableHelper isSpecialContext context
109− gfromColumns :: Rel8able t => GRep t (H context) -> t context
108+ gfromColumns :: Rel8able t => GRep t (Col context) -> t context
110− gtoColumns :: Rel8able t => t context -> GRep t (H context)
109+ gtoColumns :: Rel8able t => t context -> GRep t (Col context)
113−instance TableHelper 'True Aggregation where
112+instance TableHelper 'True Aggregate where
114− gfromColumns = fromAggregationColumns
113+ gfromColumns = fromAggregateColumns
115− gtoColumns = toAggregationColumns
114+ gtoColumns = toAggregateColumns
118−instance TableHelper 'True DB where
117+instance TableHelper 'True Expr where
119− gfromColumns = fromDBColumns
118+ gfromColumns = fromExprColumns
120− gtoColumns = toDBColumns
119+ gtoColumns = toExprColumns
123instance TableHelper 'True Insertion where
122instance TableHelper 'True Insertion where
@@ -125,9 +124,9 @@ instance TableHelper 'True Insertion where
125 gtoColumns = toInsertionColumns
124 gtoColumns = toInsertionColumns
128−instance TableHelper 'True Result where
127+instance TableHelper 'True Identity where
129− gfromColumns = fromResultColumns
128+ gfromColumns = fromIdentityColumns
130− gtoColumns = toResultColumns
129+ gtoColumns = toIdentityColumns
133instance (IsSpecialContext context ~ 'False, Labelable context, Nullifiable context) =>
132instance (IsSpecialContext context ~ 'False, Labelable context, Nullifiable context) =>
@@ -139,105 +138,105 @@ instance (IsSpecialContext context ~ 'False, Labelable context, Nullifiable cont
140type Rel8able :: KTable -> Constraint
139type Rel8able :: KTable -> Constraint
141class HTable (GRep t) => Rel8able t where
140class HTable (GRep t) => Rel8able t where
142− type GRep t :: HKTable
141+ type GRep t :: K.HTable
144− fromAggregationColumns :: GRep t (H Aggregation) -> t Aggregation
143+ fromAggregateColumns :: GRep t (Col Aggregate) -> t Aggregate
145− toAggregationColumns :: t Aggregation -> GRep t (H Aggregation)
144+ toAggregateColumns :: t Aggregate -> GRep t (Col Aggregate)
147− fromDBColumns :: GRep t (H DB) -> t DB
146+ fromExprColumns :: GRep t (Col Expr) -> t Expr
148− toDBColumns :: t DB -> GRep t (H DB)
147+ toExprColumns :: t Expr -> GRep t (Col Expr)
150− fromInsertionColumns :: GRep t (H Insertion) -> t Insertion
149+ fromInsertionColumns :: GRep t (Col Insertion) -> t Insertion
151− toInsertionColumns :: t Insertion -> GRep t (H Insertion)
150+ toInsertionColumns :: t Insertion -> GRep t (Col Insertion)
153− fromResultColumns :: GRep t (H Result) -> t Result
152+ fromIdentityColumns :: GRep t (Col Identity) -> t Identity
154− toResultColumns :: t Result -> GRep t (H Result)
153+ toIdentityColumns :: t Identity -> GRep t (Col Identity)
156 fromUnspecialColumns ::
155 fromUnspecialColumns ::
157 ( IsSpecialContext context ~ 'False
156 ( IsSpecialContext context ~ 'False
158 , Labelable context, Nullifiable context
157 , Labelable context, Nullifiable context
160− => GRep t (H context) -> t context
159+ => GRep t (Col context) -> t context
161 toUnspecialColumns ::
160 toUnspecialColumns ::
162 ( IsSpecialContext context ~ 'False
161 ( IsSpecialContext context ~ 'False
163 , Labelable context, Nullifiable context
162 , Labelable context, Nullifiable context
165− => t context -> GRep t (H context)
164+ => t context -> GRep t (Col context)
167 type GRep t = GColumns (Rep (t Structure))
166 type GRep t = GColumns (Rep (t Structure))
169− default fromAggregationColumns ::
168+ default fromAggregateColumns ::
170− ( Generic (t Aggregation)
169+ ( Generic (t Aggregate)
171 , GColumns (Rep (t Structure)) ~ GRep t
170 , GColumns (Rep (t Structure)) ~ GRep t
172− , GRel8able Aggregation (Rep (t Structure)) (Rep (t Aggregation))
171+ , GRel8able Aggregate (Rep (t Structure)) (Rep (t Aggregate))
173− ) => GRep t (H Aggregation) -> t Aggregation
172+ ) => GRep t (Col Aggregate) -> t Aggregate
174− fromAggregationColumns = to . fromGColumns @_ @(Rep (t Structure))
173+ fromAggregateColumns = to . fromGColumns @_ @(Rep (t Structure))
176− default toAggregationColumns ::
175+ default toAggregateColumns ::
177− ( Generic (t Aggregation)
176+ ( Generic (t Aggregate)
178 , GColumns (Rep (t Structure)) ~ GRep t
177 , GColumns (Rep (t Structure)) ~ GRep t
179− , GRel8able Aggregation (Rep (t Structure)) (Rep (t Aggregation))
178+ , GRel8able Aggregate (Rep (t Structure)) (Rep (t Aggregate))
180− ) => t Aggregation -> GRep t (H Aggregation)
179+ ) => t Aggregate -> GRep t (Col Aggregate)
181− toAggregationColumns = toGColumns @_ @(Rep (t Structure)) . from
180+ toAggregateColumns = toGColumns @_ @(Rep (t Structure)) . from
183− default fromDBColumns ::
182+ default fromExprColumns ::
184− ( Generic (t DB)
183+ ( Generic (t Expr)
185 , GColumns (Rep (t Structure)) ~ GRep t
184 , GColumns (Rep (t Structure)) ~ GRep t
186− , GRel8able DB (Rep (t Structure)) (Rep (t DB))
185+ , GRel8able Expr (Rep (t Structure)) (Rep (t Expr))
187− ) => GRep t (H DB) -> t DB
186+ ) => GRep t (Col Expr) -> t Expr
188− fromDBColumns = to . fromGColumns @_ @(Rep (t Structure))
187+ fromExprColumns = to . fromGColumns @_ @(Rep (t Structure))
190− default toDBColumns ::
189+ default toExprColumns ::
191− ( Generic (t DB)
190+ ( Generic (t Expr)
192 , GColumns (Rep (t Structure)) ~ GRep t
191 , GColumns (Rep (t Structure)) ~ GRep t
193− , GRel8able DB (Rep (t Structure)) (Rep (t DB))
192+ , GRel8able Expr (Rep (t Structure)) (Rep (t Expr))
194− ) => t DB -> GRep t (H DB)
193+ ) => t Expr -> GRep t (Col Expr)
195− toDBColumns = toGColumns @_ @(Rep (t Structure)) . from
194+ toExprColumns = toGColumns @_ @(Rep (t Structure)) . from
197 default fromInsertionColumns ::
196 default fromInsertionColumns ::
198 ( Generic (t Insertion)
197 ( Generic (t Insertion)
199 , GColumns (Rep (t Structure)) ~ GRep t
198 , GColumns (Rep (t Structure)) ~ GRep t
200 , GRel8able Insertion (Rep (t Structure)) (Rep (t Insertion))
199 , GRel8able Insertion (Rep (t Structure)) (Rep (t Insertion))
201− ) => GRep t (H Insertion) -> t Insertion
200+ ) => GRep t (Col Insertion) -> t Insertion
202 fromInsertionColumns = to . fromGColumns @_ @(Rep (t Structure))
201 fromInsertionColumns = to . fromGColumns @_ @(Rep (t Structure))
204 default toInsertionColumns ::
203 default toInsertionColumns ::
205 ( Generic (t Insertion)
204 ( Generic (t Insertion)
206 , GColumns (Rep (t Structure)) ~ GRep t
205 , GColumns (Rep (t Structure)) ~ GRep t
207 , GRel8able Insertion (Rep (t Structure)) (Rep (t Insertion))
206 , GRel8able Insertion (Rep (t Structure)) (Rep (t Insertion))
208− ) => t Insertion -> GRep t (H Insertion)
207+ ) => t Insertion -> GRep t (Col Insertion)
209 toInsertionColumns = toGColumns @_ @(Rep (t Structure)) . from
208 toInsertionColumns = toGColumns @_ @(Rep (t Structure)) . from
211− default fromResultColumns ::
210+ default fromIdentityColumns ::
212− ( Generic (t Result)
211+ ( Generic (t Identity)
213 , GColumns (Rep (t Structure)) ~ GRep t
212 , GColumns (Rep (t Structure)) ~ GRep t
214− , GRel8able Result (Rep (t Structure)) (Rep (t Result))
213+ , GRel8able Identity (Rep (t Structure)) (Rep (t Identity))
215− ) => GRep t (H Result) -> t Result
214+ ) => GRep t (Col Identity) -> t Identity
216− fromResultColumns = to . fromGColumns @_ @(Rep (t Structure))
215+ fromIdentityColumns = to . fromGColumns @_ @(Rep (t Structure))
218− default toResultColumns ::
217+ default toIdentityColumns ::
219− ( Generic (t Result)
218+ ( Generic (t Identity)
220 , GColumns (Rep (t Structure)) ~ GRep t
219 , GColumns (Rep (t Structure)) ~ GRep t
221− , GRel8able Result (Rep (t Structure)) (Rep (t Result))
220+ , GRel8able Identity (Rep (t Structure)) (Rep (t Identity))
222− ) => t Result -> GRep t (H Result)
221+ ) => t Identity -> GRep t (Col Identity)
223− toResultColumns = toGColumns @_ @(Rep (t Structure)) . from
222+ toIdentityColumns = toGColumns @_ @(Rep (t Structure)) . from
225 default fromUnspecialColumns ::
224 default fromUnspecialColumns ::
226 ( Generic (t context)
225 ( Generic (t context)
227 , GColumns (Rep (t Structure)) ~ GRep t
226 , GColumns (Rep (t Structure)) ~ GRep t
228 , GRel8able context (Rep (t Structure)) (Rep (t context))
227 , GRel8able context (Rep (t Structure)) (Rep (t context))
229− ) => GRep t (H context) -> t context
228+ ) => GRep t (Col context) -> t context
230 fromUnspecialColumns = to . fromGColumns @_ @(Rep (t Structure))
229 fromUnspecialColumns = to . fromGColumns @_ @(Rep (t Structure))
232 default toUnspecialColumns ::
231 default toUnspecialColumns ::
233 ( Generic (t context)
232 ( Generic (t context)
234 , GColumns (Rep (t Structure)) ~ GRep t
233 , GColumns (Rep (t Structure)) ~ GRep t
235 , GRel8able context (Rep (t Structure)) (Rep (t context))
234 , GRel8able context (Rep (t Structure)) (Rep (t context))
236− ) => t context -> GRep t (H context)
235+ ) => t context -> GRep t (Col context)
237 toUnspecialColumns = toGColumns @_ @(Rep (t Structure)) . from
236 toUnspecialColumns = toGColumns @_ @(Rep (t Structure)) . from
240−type GColumns :: (Type -> Type) -> HKTable
239+type GColumns :: (Type -> Type) -> K.HTable
241type family GColumns structure where
240type family GColumns structure where
242 GColumns (M1 D _ structure) = GColumns structure
241 GColumns (M1 D _ structure) = GColumns structure
243 GColumns (M1 C _ structure) = GColumns structure
242 GColumns (M1 C _ structure) = GColumns structure
@@ -246,10 +245,10 @@ type family GColumns structure where
246 K1Columns label structure
245 K1Columns label structure
249−type GRel8able :: Kind.Context -> (Type -> Type) -> (Type -> Type) -> Constraint
248+type GRel8able :: K.Context -> (Type -> Type) -> (Type -> Type) -> Constraint
250class GRel8able context structure rep where
249class GRel8able context structure rep where
251− fromGColumns :: GColumns structure (H context) -> rep x
250+ fromGColumns :: GColumns structure (Col context) -> rep x
252− toGColumns :: rep x -> GColumns structure (H context)
251+ toGColumns :: rep x -> GColumns structure (Col context)
255instance GRel8able context structure rep => GRel8able context (M1 D c structure) (M1 D c rep) where
254instance GRel8able context structure rep => GRel8able context (M1 D c structure) (M1 D c rep) where
@@ -285,7 +284,7 @@ instance
285 toGColumns (M1 (K1 a)) = toK1Columns @label @_ @_ @_ @structure a
284 toGColumns (M1 (K1 a)) = toK1Columns @label @_ @_ @_ @structure a
288−type K1Columns :: Symbol -> Type -> HKTable
287+type K1Columns :: Symbol -> Type -> K.HTable
289type family K1Columns label structure where
288type family K1Columns label structure where
290 K1Columns label (Shape1 'Column ('Spec '[] necessity nullability blueprint)) =
289 K1Columns label (Shape1 'Column ('Spec '[] necessity nullability blueprint)) =
291 HIdentity ('Spec '[label] necessity nullability blueprint)
290 HIdentity ('Spec '[label] necessity nullability blueprint)
@@ -327,19 +326,19 @@ type family K1Columns label structure where
327 K1Columns label a = HLabel label (Columns a)
326 K1Columns label a = HLabel label (Columns a)
330−type K1Table :: Symbol -> Bool -> Kind.Context -> Bool -> Type -> Type -> Constraint
329+type K1Table :: Symbol -> Bool -> K.Context -> Bool -> Type -> Type -> Constraint
332 ( isSpecialContext ~ IsSpecialContext context
331 ( isSpecialContext ~ IsSpecialContext context
333 , isStructure ~ IsStructure structure
332 , isStructure ~ IsStructure structure
334 ) => K1Table label isSpecialContext context isStructure structure a
333 ) => K1Table label isSpecialContext context isStructure structure a
336− fromK1Columns :: K1Columns label structure (H context) -> a
335+ fromK1Columns :: K1Columns label structure (Col context) -> a
337− toK1Columns :: a -> K1Columns label structure (H context)
336+ toK1Columns :: a -> K1Columns label structure (Col context)
341− ( x ~ Field Aggregation '[] necessity db a
340+ ( x ~ Field Aggregate '[] necessity db a
342− ) => K1Table label 'True Aggregation 'True (Shape1 'Column ('Spec '[] necessity db a)) x
341+ ) => K1Table label 'True Aggregate 'True (Shape1 'Column ('Spec '[] necessity db a)) x
344 fromK1Columns (HIdentity (Aggregation a)) = a
343 fromK1Columns (HIdentity (Aggregation a)) = a
345 toK1Columns = HIdentity . Aggregation
344 toK1Columns = HIdentity . Aggregation
@@ -348,8 +347,8 @@ instance
351− ( x ~ Field Aggregation (label ': labels) necessity db a
350+ ( x ~ Field Aggregate (label ': labels) necessity db a
352− ) => K1Table _label 'True Aggregation 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
351+ ) => K1Table _label 'True Aggregate 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
354 fromK1Columns (HIdentity (Aggregation a)) = a
353 fromK1Columns (HIdentity (Aggregation a)) = a
355 toK1Columns = HIdentity . Aggregation
354 toK1Columns = HIdentity . Aggregation
@@ -358,8 +357,8 @@ instance
361− ( x ~ Field DB '[] necessity db a
360+ ( x ~ Field Expr '[] necessity db a
362− ) => K1Table label 'True DB 'True (Shape1 'Column ('Spec '[] necessity db a)) x
361+ ) => K1Table label 'True Expr 'True (Shape1 'Column ('Spec '[] necessity db a)) x
364 fromK1Columns (HIdentity (DB a)) = a
363 fromK1Columns (HIdentity (DB a)) = a
365 toK1Columns = HIdentity . DB
364 toK1Columns = HIdentity . DB
@@ -368,8 +367,8 @@ instance
371− ( x ~ Field DB (label ': labels) necessity db a
370+ ( x ~ Field Expr (label ': labels) necessity db a
372− ) => K1Table _label 'True DB 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
371+ ) => K1Table _label 'True Expr 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
374 fromK1Columns (HIdentity (DB a)) = a
373 fromK1Columns (HIdentity (DB a)) = a
375 toK1Columns = HIdentity . DB
374 toK1Columns = HIdentity . DB
@@ -408,8 +407,8 @@ instance
411− ( x ~ Field Result '[] necessity db a
410+ ( x ~ Field Identity '[] necessity db a
412− ) => K1Table label 'True Result 'True (Shape1 'Column ('Spec '[] necessity db a)) x
411+ ) => K1Table label 'True Identity 'True (Shape1 'Column ('Spec '[] necessity db a)) x
414 fromK1Columns (HIdentity (Result a)) = a
413 fromK1Columns (HIdentity (Result a)) = a
415 toK1Columns = HIdentity . Result
414 toK1Columns = HIdentity . Result
@@ -418,8 +417,8 @@ instance
421− ( x ~ Field Result (label ': labels) necessity db a
420+ ( x ~ Field Identity (label ': labels) necessity db a
422− ) => K1Table _label 'True Result 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
421+ ) => K1Table _label 'True Identity 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
424 fromK1Columns (HIdentity (Result a)) = a
423 fromK1Columns (HIdentity (Result a)) = a
425 toK1Columns = HIdentity . Result
424 toK1Columns = HIdentity . Result
@@ -429,23 +428,23 @@ instance
431 ( IsSpecialContext context ~ 'False
430 ( IsSpecialContext context ~ 'False
432− , x ~ context ('Spec (label ': labels) necessity db a)
431+ , x ~ context a
433 ) => K1Table _label 'False context 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
432 ) => K1Table _label 'False context 'True (Shape1 'Column ('Spec (label ': labels) necessity db a)) x
435− fromK1Columns = unHIdentity
434+ fromK1Columns (HIdentity (Col a)) = a
436− toK1Columns = HIdentity
435+ toK1Columns = HIdentity . Col
437 {-# INLINABLE fromK1Columns #-}
436 {-# INLINABLE fromK1Columns #-}
438 {-# INLINABLE toK1Columns #-}
437 {-# INLINABLE toK1Columns #-}
442 ( IsSpecialContext context ~ 'False
441 ( IsSpecialContext context ~ 'False
443− , x ~ context ('Spec '[] necessity db a)
442+ , x ~ context a
444 , Labelable context
443 , Labelable context
445 ) => K1Table label 'False context 'True (Shape1 'Column ('Spec '[] necessity db a)) x
444 ) => K1Table label 'False context 'True (Shape1 'Column ('Spec '[] necessity db a)) x
447− fromK1Columns = unlabeler . unHIdentity
446+ fromK1Columns = (\(Col a) -> a) . unlabeler . unHIdentity
448− toK1Columns = HIdentity . labeler
447+ toK1Columns = HIdentity . labeler . Col
449 {-# INLINABLE fromK1Columns #-}
448 {-# INLINABLE fromK1Columns #-}
450 {-# INLINABLE toK1Columns #-}
449 {-# INLINABLE toK1Columns #-}
@@ -453,10 +452,10 @@ instance
454 ( HTable (K1Columns "Left" structure1)
453 ( HTable (K1Columns "Left" structure1)
455 , HTable (K1Columns "Right" structure2)
454 , HTable (K1Columns "Right" structure2)
456− , K1Table "Left" 'True Aggregation (IsStructure structure1) structure1 a
455+ , K1Table "Left" 'True Aggregate (IsStructure structure1) structure1 a
457− , K1Table "Right" 'True Aggregation (IsStructure structure2) structure2 b
456+ , K1Table "Right" 'True Aggregate (IsStructure structure2) structure2 b
458 , e ~ EitherTable a b
457 , 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
461 fromK1Columns =
460 fromK1Columns =
462 fromColumns2
461 fromColumns2
@@ -475,10 +474,10 @@ instance
476 ( HTable (K1Columns "Left" structure1)
475 ( HTable (K1Columns "Left" structure1)
477 , HTable (K1Columns "Right" structure2)
476 , HTable (K1Columns "Right" structure2)
478− , K1Table "Left" 'True DB (IsStructure structure1) structure1 a
477+ , K1Table "Left" 'True Expr (IsStructure structure1) structure1 a
479− , K1Table "Right" 'True DB (IsStructure structure2) structure2 b
478+ , K1Table "Right" 'True Expr (IsStructure structure2) structure2 b
480 , e ~ EitherTable a b
479 , 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
483 fromK1Columns =
482 fromK1Columns =
484 fromColumns2
483 fromColumns2
@@ -519,10 +518,10 @@ instance
520 ( HTable (K1Columns "Left" structure1)
519 ( HTable (K1Columns "Left" structure1)
521 , HTable (K1Columns "Right" structure2)
520 , HTable (K1Columns "Right" structure2)
522− , K1Table "Left" 'True Result (IsStructure structure1) structure1 a
521+ , K1Table "Left" 'True Identity (IsStructure structure1) structure1 a
523− , K1Table "Right" 'True Result (IsStructure structure2) structure2 b
522+ , K1Table "Right" 'True Identity (IsStructure structure2) structure2 b
524 , e ~ Either a b
523 , 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
527 fromK1Columns
526 fromK1Columns
@@ -566,27 +565,27 @@ instance
569− ( K1Table label 'True Aggregation (IsStructure structure) structure a
568+ ( K1Table label 'True Aggregate (IsStructure structure) structure a
570− , Table Aggregation a
569+ , Table Aggregate a
571 , K1Columns label structure ~ HLabel label (Columns a)
570 , K1Columns label structure ~ HLabel label (Columns a)
572 , as ~ ListTable a
571 , as ~ ListTable a
573− ) => K1Table label 'True Aggregation 'True (Shape1 'List structure) as
572+ ) => K1Table label 'True Aggregate 'True (Shape1 'List structure) as
575− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
574+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
576− toK1Columns = hrelabel (hlabel labeler) . toColumns
575+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
577 {-# INLINABLE fromK1Columns #-}
576 {-# INLINABLE fromK1Columns #-}
578 {-# INLINABLE toK1Columns #-}
577 {-# INLINABLE toK1Columns #-}
582− ( K1Table label 'True DB (IsStructure structure) structure a
581+ ( K1Table label 'True Expr (IsStructure structure) structure a
583− , Table DB a
582+ , Table Expr a
584 , K1Columns label structure ~ HLabel label (Columns a)
583 , K1Columns label structure ~ HLabel label (Columns a)
585 , as ~ ListTable a
584 , as ~ ListTable a
586− ) => K1Table label 'True DB 'True (Shape1 'List structure) as
585+ ) => K1Table label 'True Expr 'True (Shape1 'List structure) as
588− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
587+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
589− toK1Columns = hrelabel (hlabel labeler) . toColumns
588+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
590 {-# INLINABLE fromK1Columns #-}
589 {-# INLINABLE fromK1Columns #-}
591 {-# INLINABLE toK1Columns #-}
590 {-# INLINABLE toK1Columns #-}
@@ -598,20 +597,20 @@ instance
598 , as ~ ListTable a
597 , as ~ ListTable a
599 ) => K1Table label 'True Insertion 'True (Shape1 'List structure) as
598 ) => K1Table label 'True Insertion 'True (Shape1 'List structure) as
601− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
600+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
602− toK1Columns = hrelabel (hlabel labeler) . toColumns
601+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
603 {-# INLINABLE fromK1Columns #-}
602 {-# INLINABLE fromK1Columns #-}
604 {-# INLINABLE toK1Columns #-}
603 {-# INLINABLE toK1Columns #-}
608− ( K1Table label 'True Result (IsStructure structure) structure a
607+ ( K1Table label 'True Identity (IsStructure structure) structure a
609 , HTable (K1Columns label structure)
608 , HTable (K1Columns label structure)
610 , as ~ [a]
609 , as ~ [a]
611− ) => K1Table label 'True Result 'True (Shape1 'List structure) as
610+ ) => K1Table label 'True Identity 'True (Shape1 'List structure) as
613− fromK1Columns = fmap (fromK1Columns @label @'True @Result @_ @structure) . fromHListTable
612+ fromK1Columns = fmap (fromK1Columns @label @'True @Identity @_ @structure) . fromHListTable
614− toK1Columns = toHListTable . fmap (toK1Columns @label @'True @Result @_ @structure)
613+ toK1Columns = toHListTable . fmap (toK1Columns @label @'True @Identity @_ @structure)
615 {-# INLINABLE fromK1Columns #-}
614 {-# INLINABLE fromK1Columns #-}
616 {-# INLINABLE toK1Columns #-}
615 {-# INLINABLE toK1Columns #-}
@@ -625,23 +624,23 @@ instance
625 , as ~ ListTable a
624 , as ~ ListTable a
626 ) => K1Table label 'False context 'True (Shape1 'List structure) as
625 ) => K1Table label 'False context 'True (Shape1 'List structure) as
628− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
627+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
629− toK1Columns = hrelabel (hlabel labeler) . toColumns
628+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
630 {-# INLINABLE fromK1Columns #-}
629 {-# INLINABLE fromK1Columns #-}
631 {-# INLINABLE toK1Columns #-}
630 {-# INLINABLE toK1Columns #-}
635 ( HTable (K1Columns "Just" structure)
634 ( HTable (K1Columns "Just" structure)
636− , K1Table "Just" 'True Aggregation (IsStructure structure) structure a
635+ , K1Table "Just" 'True Aggregate (IsStructure structure) structure a
637 , ma ~ MaybeTable a
636 , ma ~ MaybeTable a
638− ) => K1Table label 'True Aggregation 'True (Shape1 'Maybe structure) ma
637+ ) => K1Table label 'True Aggregate 'True (Shape1 'Maybe structure) ma
640 fromK1Columns =
639 fromK1Columns =
641 fromColumns1 (fromK1Columns @"Just" @_ @_ @_ @structure) .
640 fromColumns1 (fromK1Columns @"Just" @_ @_ @_ @structure) .
642− hunlabel unlabeler
641+ hunlabel hunlabeler
643 toK1Columns =
642 toK1Columns =
644− hlabel labeler .
643+ hlabel hlabeler .
645 toColumns1 (toK1Columns @"Just" @_ @_ @_ @structure)
644 toColumns1 (toK1Columns @"Just" @_ @_ @_ @structure)
646 {-# INLINABLE fromK1Columns #-}
645 {-# INLINABLE fromK1Columns #-}
647 {-# INLINABLE toK1Columns #-}
646 {-# INLINABLE toK1Columns #-}
@@ -649,15 +648,15 @@ instance
651 ( HTable (K1Columns "Just" structure)
650 ( HTable (K1Columns "Just" structure)
652− , K1Table "Just" 'True DB (IsStructure structure) structure a
651+ , K1Table "Just" 'True Expr (IsStructure structure) structure a
653 , ma ~ MaybeTable a
652 , ma ~ MaybeTable a
654− ) => K1Table label 'True DB 'True (Shape1 'Maybe structure) ma
653+ ) => K1Table label 'True Expr 'True (Shape1 'Maybe structure) ma
656 fromK1Columns =
655 fromK1Columns =
657 fromColumns1 (fromK1Columns @"Just" @_ @_ @_ @structure) .
656 fromColumns1 (fromK1Columns @"Just" @_ @_ @_ @structure) .
658− hunlabel unlabeler
657+ hunlabel hunlabeler
659 toK1Columns =
658 toK1Columns =
660− hlabel labeler .
659+ hlabel hlabeler .
661 toColumns1 (toK1Columns @"Just" @_ @_ @_ @structure)
660 toColumns1 (toK1Columns @"Just" @_ @_ @_ @structure)
662 {-# INLINABLE fromK1Columns #-}
661 {-# INLINABLE fromK1Columns #-}
663 {-# INLINABLE toK1Columns #-}
662 {-# INLINABLE toK1Columns #-}
@@ -671,9 +670,9 @@ instance
672 fromK1Columns =
671 fromK1Columns =
673 fromColumns1 (fromK1Columns @"Just" @_ @_ @_ @structure) .
672 fromColumns1 (fromK1Columns @"Just" @_ @_ @_ @structure) .
674− hunlabel unlabeler
673+ hunlabel hunlabeler
675 toK1Columns =
674 toK1Columns =
676− hlabel labeler .
675+ hlabel hlabeler .
677 toColumns1 (toK1Columns @"Just" @_ @_ @_ @structure)
676 toColumns1 (toK1Columns @"Just" @_ @_ @_ @structure)
678 {-# INLINABLE fromK1Columns #-}
677 {-# INLINABLE fromK1Columns #-}
679 {-# INLINABLE toK1Columns #-}
678 {-# INLINABLE toK1Columns #-}
@@ -681,9 +680,9 @@ instance
683 ( HTable (K1Columns "Just" structure)
682 ( HTable (K1Columns "Just" structure)
684− , K1Table "Just" 'True Result (IsStructure structure) structure a
683+ , K1Table "Just" 'True Identity (IsStructure structure) structure a
685 , ma ~ Maybe a
684 , ma ~ Maybe a
686− ) => K1Table label 'True Result 'True (Shape1 'Maybe structure) ma
685+ ) => K1Table label 'True Identity 'True (Shape1 'Maybe structure) ma
688 fromK1Columns
687 fromK1Columns
689 = fmap (fromK1Columns @"Just" @_ @_ @_ @structure)
688 = fmap (fromK1Columns @"Just" @_ @_ @_ @structure)
@@ -717,27 +716,27 @@ instance
720− ( K1Table label 'True Aggregation (IsStructure structure) structure a
719+ ( K1Table label 'True Aggregate (IsStructure structure) structure a
721− , Table Aggregation a
720+ , Table Aggregate a
722 , K1Columns label structure ~ HLabel label (Columns a)
721 , K1Columns label structure ~ HLabel label (Columns a)
723 , as ~ NonEmptyTable a
722 , as ~ NonEmptyTable a
724− ) => K1Table label 'True Aggregation 'True (Shape1 'NonEmpty structure) as
723+ ) => K1Table label 'True Aggregate 'True (Shape1 'NonEmpty structure) as
726− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
725+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
727− toK1Columns = hrelabel (hlabel labeler) . toColumns
726+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
728 {-# INLINABLE fromK1Columns #-}
727 {-# INLINABLE fromK1Columns #-}
729 {-# INLINABLE toK1Columns #-}
728 {-# INLINABLE toK1Columns #-}
733− ( K1Table label 'True DB (IsStructure structure) structure a
732+ ( K1Table label 'True Expr (IsStructure structure) structure a
734− , Table DB a
733+ , Table Expr a
735 , K1Columns label structure ~ HLabel label (Columns a)
734 , K1Columns label structure ~ HLabel label (Columns a)
736 , as ~ NonEmptyTable a
735 , as ~ NonEmptyTable a
737− ) => K1Table label 'True DB 'True (Shape1 'NonEmpty structure) as
736+ ) => K1Table label 'True Expr 'True (Shape1 'NonEmpty structure) as
739− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
738+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
740− toK1Columns = hrelabel (hlabel labeler) . toColumns
739+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
741 {-# INLINABLE fromK1Columns #-}
740 {-# INLINABLE fromK1Columns #-}
742 {-# INLINABLE toK1Columns #-}
741 {-# INLINABLE toK1Columns #-}
@@ -749,20 +748,20 @@ instance
749 , as ~ NonEmptyTable a
748 , as ~ NonEmptyTable a
750 ) => K1Table label 'True Insertion 'True (Shape1 'NonEmpty structure) as
749 ) => K1Table label 'True Insertion 'True (Shape1 'NonEmpty structure) as
752− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
751+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
753− toK1Columns = hrelabel (hlabel labeler) . toColumns
752+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
754 {-# INLINABLE fromK1Columns #-}
753 {-# INLINABLE fromK1Columns #-}
755 {-# INLINABLE toK1Columns #-}
754 {-# INLINABLE toK1Columns #-}
759− ( K1Table label 'True Result (IsStructure structure) structure a
758+ ( K1Table label 'True Identity (IsStructure structure) structure a
760 , HTable (K1Columns label structure)
759 , HTable (K1Columns label structure)
761 , as ~ NonEmpty a
760 , as ~ NonEmpty a
762− ) => K1Table label 'True Result 'True (Shape1 'NonEmpty structure) as
761+ ) => K1Table label 'True Identity 'True (Shape1 'NonEmpty structure) as
764− fromK1Columns = fmap (fromK1Columns @label @'True @Result @_ @structure) . fromHNonEmptyTable
763+ fromK1Columns = fmap (fromK1Columns @label @'True @Identity @_ @structure) . fromHNonEmptyTable
765− toK1Columns = toHNonEmptyTable . fmap (toK1Columns @label @'True @Result @_ @structure)
764+ toK1Columns = toHNonEmptyTable . fmap (toK1Columns @label @'True @Identity @_ @structure)
766 {-# INLINABLE fromK1Columns #-}
765 {-# INLINABLE fromK1Columns #-}
767 {-# INLINABLE toK1Columns #-}
766 {-# INLINABLE toK1Columns #-}
@@ -776,8 +775,8 @@ instance
776 , as ~ NonEmptyTable a
775 , as ~ NonEmptyTable a
777 ) => K1Table label 'False context 'True (Shape1 'NonEmpty structure) as
776 ) => K1Table label 'False context 'True (Shape1 'NonEmpty structure) as
779− fromK1Columns = fromColumns . hrelabel (hunlabel unlabeler)
778+ fromK1Columns = fromColumns . hrelabel (hunlabel hunlabeler)
780− toK1Columns = hrelabel (hlabel labeler) . toColumns
779+ toK1Columns = hrelabel (hlabel hlabeler) . toColumns
781 {-# INLINABLE fromK1Columns #-}
780 {-# INLINABLE fromK1Columns #-}
782 {-# INLINABLE toK1Columns #-}
781 {-# INLINABLE toK1Columns #-}
@@ -785,10 +784,10 @@ instance
786 ( HTable (K1Columns "Here" structure1)
785 ( HTable (K1Columns "Here" structure1)
787 , HTable (K1Columns "There" structure2)
786 , HTable (K1Columns "There" structure2)
788− , K1Table "Here" 'True Aggregation (IsStructure structure1) structure1 a
787+ , K1Table "Here" 'True Aggregate (IsStructure structure1) structure1 a
789− , K1Table "There" 'True Aggregation (IsStructure structure2) structure2 b
788+ , K1Table "There" 'True Aggregate (IsStructure structure2) structure2 b
790 , e ~ TheseTable a b
789 , 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
793 fromK1Columns =
792 fromK1Columns =
794 fromColumns2
793 fromColumns2
@@ -807,10 +806,10 @@ instance
808 ( HTable (K1Columns "Here" structure1)
807 ( HTable (K1Columns "Here" structure1)
809 , HTable (K1Columns "There" structure2)
808 , HTable (K1Columns "There" structure2)
810− , K1Table "Here" 'True DB (IsStructure structure1) structure1 a
809+ , K1Table "Here" 'True Expr (IsStructure structure1) structure1 a
811− , K1Table "There" 'True DB (IsStructure structure2) structure2 b
810+ , K1Table "There" 'True Expr (IsStructure structure2) structure2 b
812 , e ~ TheseTable a b
811 , 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
815 fromK1Columns =
814 fromK1Columns =
816 fromColumns2
815 fromColumns2
@@ -851,10 +850,10 @@ instance
852 ( HTable (K1Columns "Here" structure1)
851 ( HTable (K1Columns "Here" structure1)
853 , HTable (K1Columns "There" structure2)
852 , HTable (K1Columns "There" structure2)
854− , K1Table "Here" 'True Result (IsStructure structure1) structure1 a
853+ , K1Table "Here" 'True Identity (IsStructure structure1) structure1 a
855− , K1Table "There" 'True Result (IsStructure structure2) structure2 b
854+ , K1Table "There" 'True Identity (IsStructure structure2) structure2 b
856 , e ~ These a b
855 , 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
859 fromK1Columns
858 fromK1Columns