on master help sign in
Document some expression aggregations
b2c47abOllie Charles
src/Rel8/Expr/Aggregate.hs+3−1
@@ -90,6 +90,7 @@ or = unsafeMakeAggregate toPrimExpr fromPrimExpr $
90 }
90 }
91
91
92
92
93+-- | Produce an aggregation for @Expr a@ using the @max@ function.
93max :: (DBMax db, Nullabilizes db a) => Expr a -> Aggregate (Expr a)
94max :: (DBMax db, Nullabilizes db a) => Expr a -> Aggregate (Expr a)
94max = unsafeMakeAggregate toPrimExpr fromPrimExpr $
95max = unsafeMakeAggregate toPrimExpr fromPrimExpr $
95 Just Aggregator
96 Just Aggregator
@@ -99,6 +100,7 @@ max = unsafeMakeAggregate toPrimExpr fromPrimExpr $
99 }
100 }
100
101
101
102
103+-- | Produce an aggregation for @Expr a@ using the @max@ function.
102min :: (DBMin db, Nullabilizes db a) => Expr a -> Aggregate (Expr a)
104min :: (DBMin db, Nullabilizes db a) => Expr a -> Aggregate (Expr a)
103min = unsafeMakeAggregate toPrimExpr fromPrimExpr $
105min = unsafeMakeAggregate toPrimExpr fromPrimExpr $
104 Just Aggregator
106 Just Aggregator
@@ -107,7 +109,7 @@ min = unsafeMakeAggregate toPrimExpr fromPrimExpr $
107 , distinction = Opaleye.AggrAll
109 , distinction = Opaleye.AggrAll
108 }
110 }
109
111
110−
112+-- | Corresponds to @sum@.
111sum :: (DBSum db, Nullabilizes db a) => Expr a -> Aggregate (Expr a)
113sum :: (DBSum db, Nullabilizes db a) => Expr a -> Aggregate (Expr a)
112sum = unsafeMakeAggregate toPrimExpr (castExpr . fromPrimExpr) $
114sum = unsafeMakeAggregate toPrimExpr (castExpr . fromPrimExpr) $
113 Just Aggregator
115 Just Aggregator