@@ -29,8 +29,8 @@ import GHC.TypeLits ( Symbol )
29import Prelude
29import Prelude
32−import Rel8.Aggregate ( Col( A ), Aggregate( Aggregate ) )
32+import Rel8.Aggregate ( Aggregate( A, Aggregate ) )
33−import Rel8.Expr ( Col( E ), Expr )
33+import Rel8.Expr ( Expr( E ) )
34import Rel8.Expr.Aggregate ( groupByExpr )
34import Rel8.Expr.Aggregate ( groupByExpr )
35import Rel8.Expr.Eq ( (==.) )
35import Rel8.Expr.Eq ( (==.) )
36import Rel8.Expr.Null ( nullify, snull, unsafeUnnullify )
36import Rel8.Expr.Null ( nullify, snull, unsafeUnnullify )
@@ -59,7 +59,7 @@ import Rel8.Schema.Context.Nullify ( sguard, snullify )
59import Rel8.Schema.HTable ( HTable )
59import Rel8.Schema.HTable ( HTable )
60import Rel8.Schema.HTable.Identity ( HIdentity( HType ) )
60import Rel8.Schema.HTable.Identity ( HIdentity( HType ) )
61import qualified Rel8.Schema.Kind as K
61import qualified Rel8.Schema.Kind as K
62−import Rel8.Schema.Name ( Col( N ), Name( Name ) )
62+import Rel8.Schema.Name ( Name( N, Name ) )
63import Rel8.Schema.Null ( Nullity( Null, NotNull ) )
63import Rel8.Schema.Null ( Nullity( Null, NotNull ) )
64import Rel8.Schema.Spec ( SSpec( SSpec, nullity, info ) )
64import Rel8.Schema.Spec ( SSpec( SSpec, nullity, info ) )
65import Rel8.Table
65import Rel8.Table
@@ -86,11 +86,11 @@ type family GGBuildable' algebra name rep where
86 GGBuildable' 'K.Product name rep =
86 GGBuildable' 'K.Product name rep =
87 ( name ~ GConstructor (Eval (rep Expr))
87 ( name ~ GConstructor (Eval (rep Expr))
88 , Representable Id (Eval (rep Expr))
88 , Representable Id (Eval (rep Expr))
89− , GConstructable (TTable Expr) TColumns Id (Col Expr) (Eval (rep Expr))
89+ , GConstructable (TTable Expr) TColumns Id Expr (Eval (rep Expr))
91 GGBuildable' 'K.Sum name rep =
91 GGBuildable' 'K.Sum name rep =
92 ( Representable Id (GConstructorADT name (Eval (rep Expr)))
92 ( Representable Id (GConstructorADT name (Eval (rep Expr)))
93− , GMakeableADT (TTable Expr) TColumns Id (Col Expr) name (Eval (rep Expr))
93+ , GMakeableADT (TTable Expr) TColumns Id Expr name (Eval (rep Expr))
@@ -103,7 +103,7 @@ type family GGBuild algebra name rep r where
105ggbuild :: forall algebra name rep a. GGBuildable algebra name rep
105ggbuild :: forall algebra name rep a. GGBuildable algebra name rep
106− => (Eval (GGColumns algebra TColumns (Eval (rep Expr))) (Col Expr) -> a)
106+ => (Eval (GGColumns algebra TColumns (Eval (rep Expr))) Expr -> a)
107 -> GGBuild algebra name rep a
107 -> GGBuild algebra name rep a
108ggbuild gfromColumns = case algebraSing @algebra of
108ggbuild gfromColumns = case algebraSing @algebra of
109 SProduct ->
109 SProduct ->
@@ -113,7 +113,7 @@ ggbuild gfromColumns = case algebraSing @algebra of
113 @(TTable Expr)
113 @(TTable Expr)
114 @TColumns
114 @TColumns
116− @(Col Expr)
116+ @Expr
117 @(Eval (rep Expr))
117 @(Eval (rep Expr))
118 (const toColumns)
118 (const toColumns)
@@ -123,7 +123,7 @@ ggbuild gfromColumns = case algebraSing @algebra of
123 @(TTable Expr)
123 @(TTable Expr)
124 @TColumns
124 @TColumns
126− @(Col Expr)
126+ @Expr
128 @(Eval (rep Expr))
128 @(Eval (rep Expr))
129 (const toColumns)
129 (const toColumns)
@@ -151,9 +151,9 @@ type family GGConstructable' algebra rep where
151 ( Representable Id (Eval (rep Aggregate))
151 ( Representable Id (Eval (rep Aggregate))
152 , Representable Id (Eval (rep Expr))
152 , Representable Id (Eval (rep Expr))
153 , Representable Id (Eval (rep Name))
153 , Representable Id (Eval (rep Name))
154− , GConstructable (TTable Aggregate) TColumns Id (Col Aggregate) (Eval (rep Aggregate))
154+ , GConstructable (TTable Aggregate) TColumns Id Aggregate (Eval (rep Aggregate))
155− , GConstructable (TTable Expr) TColumns Id (Col Expr) (Eval (rep Expr))
155+ , GConstructable (TTable Expr) TColumns Id Expr (Eval (rep Expr))
156− , GConstructable (TTable Name) TColumns Id (Col Name) (Eval (rep Name))
156+ , GConstructable (TTable Name) TColumns Id Name (Eval (rep Name))
158 GGConstructable' 'K.Sum rep =
158 GGConstructable' 'K.Sum rep =
159 ( RepresentableConstructors Id (Eval (rep Expr))
159 ( RepresentableConstructors Id (Eval (rep Expr))
@@ -161,9 +161,9 @@ type family GGConstructable' algebra rep where
161 , RepresentableFields Id (Eval (rep Expr))
161 , RepresentableFields Id (Eval (rep Expr))
162 , RepresentableFields Id (Eval (rep Name))
162 , RepresentableFields Id (Eval (rep Name))
163 , Functor (GConstructors Id (Eval (rep Expr)))
163 , Functor (GConstructors Id (Eval (rep Expr)))
164− , GConstructableADT (TTable Aggregate) TColumns Id (Col Aggregate) (Eval (rep Aggregate))
164+ , GConstructableADT (TTable Aggregate) TColumns Id Aggregate (Eval (rep Aggregate))
165− , GConstructableADT (TTable Expr) TColumns Id (Col Expr) (Eval (rep Expr))
165+ , GConstructableADT (TTable Expr) TColumns Id Expr (Eval (rep Expr))
166− , GConstructableADT (TTable Name) TColumns Id (Col Name) (Eval (rep Name))
166+ , GConstructableADT (TTable Name) TColumns Id Name (Eval (rep Name))
@@ -174,7 +174,7 @@ type family GGConstruct algebra rep r where
176ggconstruct :: forall algebra rep a. GGConstructable algebra rep
176ggconstruct :: forall algebra rep a. GGConstructable algebra rep
177− => (Eval (GGColumns algebra TColumns (Eval (rep Expr))) (Col Expr) -> a)
177+ => (Eval (GGColumns algebra TColumns (Eval (rep Expr))) Expr -> a)
178 -> GGConstruct algebra rep a -> a
178 -> GGConstruct algebra rep a -> a
179ggconstruct gfromColumns f = case algebraSing @algebra of
179ggconstruct gfromColumns f = case algebraSing @algebra of
180 SProduct ->
180 SProduct ->
@@ -185,7 +185,7 @@ ggconstruct gfromColumns f = case algebraSing @algebra of
185 @(TTable Expr)
185 @(TTable Expr)
186 @TColumns
186 @TColumns
188− @(Col Expr)
188+ @Expr
189 @(Eval (rep Expr))
189 @(Eval (rep Expr))
190 (const toColumns)
190 (const toColumns)
@@ -195,7 +195,7 @@ ggconstruct gfromColumns f = case algebraSing @algebra of
195 @(TTable Expr)
195 @(TTable Expr)
196 @TColumns
196 @TColumns
198− @(Col Expr)
198+ @Expr
199 @(Eval (rep Expr))
199 @(Eval (rep Expr))
200 (const toColumns)
200 (const toColumns)
201 (\SSpec {info} -> E (snull info))
201 (\SSpec {info} -> E (snull info))
@@ -214,7 +214,7 @@ type family GGDeconstruct algebra rep a r where
216ggdeconstruct :: forall algebra rep a r. (GGConstructable algebra rep, Table Expr r)
216ggdeconstruct :: forall algebra rep a r. (GGConstructable algebra rep, Table Expr r)
217− => (a -> Eval (GGColumns algebra TColumns (Eval (rep Expr))) (Col Expr))
217+ => (a -> Eval (GGColumns algebra TColumns (Eval (rep Expr))) Expr)
218 -> GGDeconstruct algebra rep a r
218 -> GGDeconstruct algebra rep a r
219ggdeconstruct gtoColumns = case algebraSing @algebra of
219ggdeconstruct gtoColumns = case algebraSing @algebra of
220 SProduct -> \build ->
220 SProduct -> \build ->
@@ -223,7 +223,7 @@ ggdeconstruct gtoColumns = case algebraSing @algebra of
223 @(TTable Expr)
223 @(TTable Expr)
224 @TColumns
224 @TColumns
226− @(Col Expr)
226+ @Expr
227 @(Eval (rep Expr))
227 @(Eval (rep Expr))
228 (const fromColumns) .
228 (const fromColumns) .
229 gtoColumns
229 gtoColumns
@@ -235,7 +235,7 @@ ggdeconstruct gtoColumns = case algebraSing @algebra of
235 @(TTable Expr)
235 @(TTable Expr)
236 @TColumns
236 @TColumns
238− @(Col Expr)
238+ @Expr
239 @(Eval (rep Expr))
239 @(Eval (rep Expr))
240 (const fromColumns)
240 (const fromColumns)
241 (\SSpec {nullity} -> case nullity of
241 (\SSpec {nullity} -> case nullity of
@@ -256,7 +256,7 @@ type family GGName algebra rep a where
258ggname :: forall algebra rep a. GGConstructable algebra rep
258ggname :: forall algebra rep a. GGConstructable algebra rep
259− => (Eval (GGColumns algebra TColumns (Eval (rep Expr))) (Col Name) -> a)
259+ => (Eval (GGColumns algebra TColumns (Eval (rep Expr))) Name -> a)
260 -> GGName algebra rep a
260 -> GGName algebra rep a
261ggname gfromColumns = case algebraSing @algebra of
261ggname gfromColumns = case algebraSing @algebra of
262 SProduct ->
262 SProduct ->
@@ -266,7 +266,7 @@ ggname gfromColumns = case algebraSing @algebra of
266 @(TTable Name)
266 @(TTable Name)
267 @TColumns
267 @TColumns
269− @(Col Name)
269+ @Name
270 @(Eval (rep Name))
270 @(Eval (rep Name))
271 (const toColumns)
271 (const toColumns)
272 SSum -> \tag ->
272 SSum -> \tag ->
@@ -276,7 +276,7 @@ ggname gfromColumns = case algebraSing @algebra of
276 @(TTable Name)
276 @(TTable Name)
277 @TColumns
277 @TColumns
279− @(Col Name)
279+ @Name
280 @(Eval (rep Name))
280 @(Eval (rep Name))
281 (const toColumns)
281 (const toColumns)
282 (\_ _ (N (Name a)) -> N (Name a))
282 (\_ _ (N (Name a)) -> N (Name a))
@@ -294,8 +294,8 @@ type family GGAggregate algebra rep r where
296ggaggregate :: forall algebra rep exprs agg. GGConstructable algebra rep
296ggaggregate :: forall algebra rep exprs agg. GGConstructable algebra rep
297− => (Eval (GGColumns algebra TColumns (Eval (rep Expr))) (Col Aggregate) -> agg)
297+ => (Eval (GGColumns algebra TColumns (Eval (rep Expr))) Aggregate -> agg)
298− -> (exprs -> Eval (GGColumns algebra TColumns (Eval (rep Expr))) (Col Expr))
298+ -> (exprs -> Eval (GGColumns algebra TColumns (Eval (rep Expr))) Expr)
299 -> GGAggregate algebra rep agg -> exprs -> agg
299 -> GGAggregate algebra rep agg -> exprs -> agg
300ggaggregate gfromColumns gtoColumns agg es = case algebraSing @algebra of
300ggaggregate gfromColumns gtoColumns agg es = case algebraSing @algebra of
301 SProduct -> flip f exprs $
301 SProduct -> flip f exprs $
@@ -304,7 +304,7 @@ ggaggregate gfromColumns gtoColumns agg es = case algebraSing @algebra of
304 @(TTable Aggregate)
304 @(TTable Aggregate)
305 @TColumns
305 @TColumns
307− @(Col Aggregate)
307+ @Aggregate
308 @(Eval (rep Aggregate))
308 @(Eval (rep Aggregate))
309 (const toColumns)
309 (const toColumns)
@@ -317,7 +317,7 @@ ggaggregate gfromColumns gtoColumns agg es = case algebraSing @algebra of
317 @(TTable Expr)
317 @(TTable Expr)
318 @TColumns
318 @TColumns
320− @(Col Expr)
320+ @Expr
321 @(Eval (rep Expr))
321 @(Eval (rep Expr))
322 (const fromColumns) $
322 (const fromColumns) $
323 gtoColumns es
323 gtoColumns es
@@ -327,7 +327,7 @@ ggaggregate gfromColumns gtoColumns agg es = case algebraSing @algebra of
327 @(TTable Aggregate)
327 @(TTable Aggregate)
328 @TColumns
328 @TColumns
330− @(Col Aggregate)
330+ @Aggregate
331 @(Eval (rep Aggregate))
331 @(Eval (rep Aggregate))
332 (const toColumns)
332 (const toColumns)
333 (\tag' SSpec {nullity} (A (Aggregate a)) ->
333 (\tag' SSpec {nullity} (A (Aggregate a)) ->
@@ -343,7 +343,7 @@ ggaggregate gfromColumns gtoColumns agg es = case algebraSing @algebra of
343 @(TTable Expr)
343 @(TTable Expr)
344 @TColumns
344 @TColumns
346− @(Col Expr)
346+ @Expr
347 @(Eval (rep Expr))
347 @(Eval (rep Expr))
348 (const fromColumns)
348 (const fromColumns)
349 (\SSpec {nullity} -> case nullity of
349 (\SSpec {nullity} -> case nullity of