on master help sign in
Actually fix DBSemigroup instance for lists
commit89ec060e6f050d0a1d59d2b574f6a0f67db65cb3 authorShane O'Brien <shane.obrien@circuithub.com> dateSun 13 Jun 2021, 10:22 (5 years ago) parent64e3fc5
1 file changed+7−4
src/Rel8/Type/Semigroup.hs+7−4
src/Rel8/Type/Semigroup.hs+7−4
@@ -1,3 +1,4 @@
1+{-# language BlockArguments #-}
12{-# language DataKinds #-}
23{-# language FlexibleContexts #-}
34{-# language FlexibleInstances #-}
@@ -15,7 +16,7 @@ where
1516import Data.Function ( on )
1617import Data.Kind ( Constraint, Type )
1718import Data.List.NonEmpty ( NonEmpty )
18−import Prelude ()
19+import Prelude
1920
2021-- bytestring
2122import Data.ByteString ( ByteString )
@@ -32,7 +33,7 @@ import {-# SOURCE #-} Rel8.Expr ( Expr )
3233import Rel8.Expr.Opaleye ( zipPrimExprsWith )
3334import Rel8.Schema.Null ( Sql )
3435import Rel8.Type ( DBType )
35−import Rel8.Type.Array ( toPrimArray )
36+import Rel8.Type.Array ( fromPrimArray, toPrimArray )
3637
3738-- text
3839import Data.Text ( Text )
@@ -52,11 +53,13 @@ class DBType a => DBSemigroup a where
5253
5354
5455instance Sql DBType a => DBSemigroup [a] where
55− (<>.) = zipPrimExprsWith (Opaleye.BinExpr (Opaleye.:||) `on` toPrimArray)
56+ (<>.) = zipPrimExprsWith do
57+ (fromPrimArray .) . Opaleye.BinExpr (Opaleye.:||) `on` toPrimArray
5658
5759
5860instance Sql DBType a => DBSemigroup (NonEmpty a) where
59− (<>.) = zipPrimExprsWith (Opaleye.BinExpr (Opaleye.:||) `on` toPrimArray)
61+ (<>.) = zipPrimExprsWith do
62+ (fromPrimArray .) . Opaleye.BinExpr (Opaleye.:||) `on` toPrimArray
6063
6164
6265instance DBSemigroup CalendarDiffTime where