opaleye 0.6.7006.0 → 0.6.7006.1
raw patch · 4 files changed
+23/−1 lines, 4 filesPVP: minor bump suggested
API additions: PVP suggests at least a minor version bump
API changes (from Hackage documentation)
+ Opaleye.Aggregate: sumInt4 :: Aggregator (Column SqlInt4) (Column SqlInt8)
+ Opaleye.Aggregate: sumInt8 :: Aggregator (Column SqlInt8) (Column SqlNumeric)
+ Opaleye.Internal.Inferrable: instance (scientific Data.Type.Equality.~ Data.Scientific.Scientific) => Data.Profunctor.Product.Default.Class.Default (Opaleye.Internal.Inferrable.Inferrable Opaleye.Internal.RunQuery.FromField) Opaleye.SqlTypes.SqlNumeric scientific
Files
- CHANGELOG.md +8/−0
- opaleye.cabal +1/−1
- src/Opaleye/Aggregate.hs +10/−0
- src/Opaleye/Internal/Inferrable.hs +4/−0
CHANGELOG.md view
@@ -1,3 +1,11 @@+## 0.6.7006.1++* Add `sumInt4` and `sumInt8` `Aggregator`s, which don't crash at run+ time (`sum` currently does on those types).++* Add inferrable `FromFields` instance for `SqlNumeric` to+ `Scientific`.+ ## 0.6.7006.0 * Added `Opaleye.RunSelect.runSelectI` and
opaleye.cabal view
@@ -1,6 +1,6 @@ name: opaleye copyright: Copyright (c) 2014-2018 Purely Agile Limited; 2019-2020 Tom Ellis-version: 0.6.7006.0+version: 0.6.7006.1 synopsis: An SQL-generating DSL targeting PostgreSQL description: An SQL-generating DSL targeting PostgreSQL. Allows Postgres queries to be written within Haskell in a
src/Opaleye/Aggregate.hs view
@@ -99,8 +99,18 @@ groupBy = A.makeAggr' Nothing -- | Sum all rows in a group.+--+-- WARNING! The type of this operation is wrong and will crash at+-- runtime when the argument is 'T.SqlInt4' or 'T.SqlInt8'. For those+-- use 'sumInt4' or 'sumInt8' instead. sum :: Aggregator (C.Column a) (C.Column a) sum = A.makeAggr HPQ.AggrSum++sumInt4 :: Aggregator (C.Column T.SqlInt4) (C.Column T.SqlInt8)+sumInt4 = fmap C.unsafeCoerceColumn Opaleye.Aggregate.sum++sumInt8 :: Aggregator (C.Column T.SqlInt8) (C.Column T.SqlNumeric)+sumInt8 = fmap C.unsafeCoerceColumn Opaleye.Aggregate.sum -- | Count the number of non-null rows in a group. count :: Aggregator (C.Column a) (C.Column T.SqlInt8)
src/Opaleye/Internal/Inferrable.hs view
@@ -60,6 +60,10 @@ instance double ~ Double => D.Default (Inferrable FromField) T.SqlFloat8 double where def = Inferrable D.def +instance scientific ~ Sci.Scientific+ => D.Default (Inferrable FromField) T.SqlNumeric scientific where+ def = Inferrable D.def+ instance bool ~ Bool => D.Default (Inferrable FromField) T.SqlBool bool where def = Inferrable D.def