From 6350f1f7d590b327736a497932d78a3f91b374c6 Mon Sep 17 00:00:00 2001 From: Shane O'Brien Date: Wed, 11 Oct 2023 18:24:16 +0100 Subject: [PATCH] Relax the type of the Unpackspec for makeAggrExplicit --- src/Opaleye/Aggregate.hs | 4 ++-- src/Opaleye/Internal/Aggregate.hs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Opaleye/Aggregate.hs b/src/Opaleye/Aggregate.hs index c0f969281..c42a342fc 100644 --- a/src/Opaleye/Aggregate.hs +++ b/src/Opaleye/Aggregate.hs @@ -37,7 +37,6 @@ module Opaleye.Aggregate import Data.Profunctor (lmap) import qualified Data.Profunctor as P -import Data.Profunctor.Product.Default (def) import qualified Opaleye.Internal.Aggregate as A import Opaleye.Internal.Aggregate (Aggregator, orderAggregate) @@ -47,6 +46,7 @@ import qualified Opaleye.Internal.HaskellDB.PrimQuery as HPQ import qualified Opaleye.Internal.Operators as O import qualified Opaleye.Internal.PackMap as PM import qualified Opaleye.Internal.Tag as Tag +import qualified Opaleye.Internal.Unpackspec as U import qualified Opaleye.Field as F import qualified Opaleye.Order as Ord @@ -195,7 +195,7 @@ jsonAgg = A.makeAggr HPQ.JsonArr stringAgg :: F.Field T.SqlText -> Aggregator (F.Field T.SqlText) (F.Field T.SqlText) stringAgg delimiter = - lmap (\a -> (a, delimiter)) $ A.makeAggrExplicit def HPQ.AggrStringAggr + A.makeAggrExplicit (U.unpackspecField <* lmap (const delimiter) U.unpackspecField) HPQ.AggrStringAggr -- | Count the number of rows in a query. This is different from -- 'aggregate' 'count' because it always returns exactly one row, even diff --git a/src/Opaleye/Internal/Aggregate.hs b/src/Opaleye/Internal/Aggregate.hs index 62f43750f..d3d6a480f 100644 --- a/src/Opaleye/Internal/Aggregate.hs +++ b/src/Opaleye/Internal/Aggregate.hs @@ -46,7 +46,7 @@ makeAggr' mAggrOp = P.dimap C.unColumn C.Column $ Aggregator (PM.PackMap makeAggr :: HPQ.AggrOp -> Aggregator (C.Field_ n a) (C.Field_ n' b) makeAggr = makeAggr' . Just -makeAggrExplicit :: U.Unpackspec a a -> HPQ.AggrOp -> Aggregator a (C.Field_ n b) +makeAggrExplicit :: U.Unpackspec a a' -> HPQ.AggrOp -> Aggregator a (C.Field_ n b) makeAggrExplicit unpackspec op = C.Column <$> Aggregator (PM.PackMap (\f e -> f (aggr e))) where