on master help sign in
Document some expression aggregations
commitb2c47abf811d41be9896308673af48af65eb2d8d authorOllie Charles <ollie@ocharles.org.uk> dateTue 23 Mar 2021, 16:26 (6 years ago) parent669b262
1 file changed+3−1
src/Rel8/Expr/Aggregate.hs+3−1
src/Rel8/Expr/Aggregate.hs+3−1
@@ -90,6 +90,7 @@ or = unsafeMakeAggregate toPrimExpr fromPrimExpr $
9090 }
9191
9292
93+-- | Produce an aggregation for @Expr a@ using the @max@ function.
9394max :: (DBMax db, Nullabilizes db a) => Expr a -> Aggregate (Expr a)
9495max = unsafeMakeAggregate toPrimExpr fromPrimExpr $
9596 Just Aggregator
@@ -99,6 +100,7 @@ max = unsafeMakeAggregate toPrimExpr fromPrimExpr $
99100 }
100101
101102
103+-- | Produce an aggregation for @Expr a@ using the @max@ function.
102104min :: (DBMin db, Nullabilizes db a) => Expr a -> Aggregate (Expr a)
103105min = unsafeMakeAggregate toPrimExpr fromPrimExpr $
104106 Just Aggregator
@@ -107,7 +109,7 @@ min = unsafeMakeAggregate toPrimExpr fromPrimExpr $
107109 , distinction = Opaleye.AggrAll
108110 }
109111
110−
112+-- | Corresponds to @sum@.
111113sum :: (DBSum db, Nullabilizes db a) => Expr a -> Aggregate (Expr a)
112114sum = unsafeMakeAggregate toPrimExpr (castExpr . fromPrimExpr) $
113115 Just Aggregator