on master help sign in
Now that we have `orderTabulation`, I'm not sure we need `listAggWithOrder` and friends
bdb75e6Shane O'Brien
src/Rel8.hs+2−2
@@ -219,8 +219,8 @@ module Rel8
219 , groupBy
219 , groupBy
220 , headAgg
220 , headAgg
221 , array1DAggExpr
221 , array1DAggExpr
222− , listAgg, listAggWithOrder, listAggExpr
222+ , listAgg, listAggExpr
223− , nonEmptyAgg, nonEmptyAggWithOrder, nonEmptyAggExpr
223+ , nonEmptyAgg, nonEmptyAggExpr
224 , DBMax, max
224 , DBMax, max
225 , DBMin, min
225 , DBMin, min
226 , DBSum, sum, sumWhere
226 , DBSum, sum, sumWhere
src/Rel8/Expr/Aggregate.hs−25
@@ -14,7 +14,6 @@ module Rel8.Expr.Aggregate
14 , groupByExpr
14 , groupByExpr
15 , headAggExpr
15 , headAggExpr
16 , array1DAggExpr, listAggExpr, nonEmptyAggExpr
16 , array1DAggExpr, listAggExpr, nonEmptyAggExpr
17− , listAggExprWithOrder, nonEmptyAggExprWithOrder
18 )
17 )
19where
18where
20
19
@@ -38,7 +37,6 @@ import Rel8.Expr.Opaleye
38 )
37 )
39import Rel8.Expr.Null ( null )
38import Rel8.Expr.Null ( null )
40import Rel8.Expr.Serialize ( litExpr )
39import Rel8.Expr.Serialize ( litExpr )
41−import Rel8.Order ( Order, toOrderExprs )
42import Rel8.Schema.Null ( Sql )
40import Rel8.Schema.Null ( Sql )
43import Rel8.Type.Array ( fromPrimArray )
41import Rel8.Type.Array ( fromPrimArray )
44import Rel8.Type.Array1D ( Array1D, NotArray )
42import Rel8.Type.Array1D ( Array1D, NotArray )
@@ -202,26 +200,3 @@ nonEmptyAggExpr = unsafeMakeAggregate toPrimExpr from $ Just
202 }
200 }
203 where
201 where
204 from = fromPrimExpr . fromPrimArray
202 from = fromPrimExpr . fromPrimArray
205−
206−
207−listAggExprWithOrder :: Order o -> o -> Expr a -> Aggregate (Expr [a])
208−listAggExprWithOrder order o = unsafeMakeAggregate toPrimExpr from $ Just
209− Aggregator
210− { operation = Opaleye.AggrArr
211− , ordering = toOrderExprs order o
212− , distinction = Opaleye.AggrAll
213− }
214− where
215− from = fromPrimExpr . fromPrimArray
216−
217−
218−nonEmptyAggExprWithOrder :: ()
219− => Order o -> o -> Expr a -> Aggregate (Expr (NonEmpty a))
220−nonEmptyAggExprWithOrder order o = unsafeMakeAggregate toPrimExpr from $ Just
221− Aggregator
222− { operation = Opaleye.AggrArr
223− , ordering = toOrderExprs order o
224− , distinction = Opaleye.AggrAll
225− }
226− where
227− from = fromPrimExpr . fromPrimArray
src/Rel8/Table/Aggregate.hs−20
@@ -8,7 +8,6 @@ module Rel8.Table.Aggregate
8 ( groupBy
8 ( groupBy
9 , headAgg
9 , headAgg
10 , listAgg, nonEmptyAgg
10 , listAgg, nonEmptyAgg
11− , listAggWithOrder, nonEmptyAggWithOrder
12 )
11 )
13where
12where
14
13
@@ -23,11 +22,8 @@ import Rel8.Expr.Aggregate
23 ( groupByExpr
22 ( groupByExpr
24 , headAggExpr
23 , headAggExpr
25 , listAggExpr
24 , listAggExpr
26− , listAggExprWithOrder
27 , nonEmptyAggExpr
25 , nonEmptyAggExpr
28− , nonEmptyAggExprWithOrder
29 )
26 )
30−import Rel8.Order ( Order )
31import Rel8.Schema.Dict ( Dict( Dict ) )
27import Rel8.Schema.Dict ( Dict( Dict ) )
32import Rel8.Schema.HTable ( hfield, hmap, htabulate )
28import Rel8.Schema.HTable ( hfield, hmap, htabulate )
33import Rel8.Schema.HTable.Vectorize ( hvectorize )
29import Rel8.Schema.HTable.Vectorize ( hvectorize )
@@ -80,19 +76,3 @@ nonEmptyAgg (toColumns -> exprs) = fromColumns $
80 hvectorize
76 hvectorize
81 (\_ (Identity (E a)) -> A $ nonEmptyAggExpr a)
77 (\_ (Identity (E a)) -> A $ nonEmptyAggExpr a)
82 (pure exprs)
78 (pure exprs)
83−
84−
85−listAggWithOrder :: Table Expr a
86− => Order o -> o -> a -> Aggregate (ListTable a)
87−listAggWithOrder order o (toColumns -> exprs) = fromColumns $
88− hvectorize
89− (\_ (Identity (E x)) -> A $ listAggExprWithOrder order o x)
90− (pure exprs)
91−
92−
93−nonEmptyAggWithOrder :: Table Expr a
94− => Order o -> o -> a -> Aggregate (NonEmptyTable a)
95−nonEmptyAggWithOrder order o (toColumns -> exprs) = fromColumns $
96− hvectorize
97− (\_ (Identity (E x)) -> A $ nonEmptyAggExprWithOrder order o x)
98− (pure exprs)