Skip to content

Commit

Permalink
Increase compatibility with newer patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantrinkle committed Jun 23, 2023
1 parent 5e85b5d commit 3ce55d4
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
14 changes: 13 additions & 1 deletion reflex.cabal
Expand Up @@ -61,6 +61,11 @@ flag split-these
manual: False
default: True

flag commutative-semigroup
description: Use Data.Semigroup.Commutative instead of Data.Semigroup.Additive
manual: False
default: True

library
default-language: Haskell2010
hs-source-dirs: src
Expand All @@ -79,7 +84,6 @@ library
mmorph >= 1.0 && < 1.2,
monad-control >= 1.0.1 && < 1.1,
mtl >= 2.1 && < 2.3,
patch >= 0.0.1 && < 0.1,
prim-uniq >= 0.1.0.1 && < 0.3,
primitive >= 0.5 && < 0.8,
profunctors >= 5.3 && < 5.7,
Expand All @@ -94,6 +98,14 @@ library
unbounded-delays >= 0.1.0.0 && < 0.2,
witherable >= 0.3 && < 0.4

if flag(commutative-semigroup)
build-depends:
patch >= 0.0.7 && < 0.1,
commutative-semigroups >= 0 && < 0.2
else
build-depends:
patch >= 0.0.1 && < 0.0.7

if flag(split-these)
build-depends: these >= 1 && <1.2,
semialign >=1 && <1.2,
Expand Down
1 change: 1 addition & 0 deletions src/Reflex/Query/Base.hs
Expand Up @@ -43,6 +43,7 @@ import Data.Monoid ((<>))
import qualified Data.Semigroup as S
import Data.Some (Some(Some))
import Data.These
import Data.Semigroup.Additive

import Reflex.Class
import Reflex.Adjustable.Class
Expand Down
8 changes: 8 additions & 0 deletions src/Reflex/Query/Class.hs
Expand Up @@ -38,6 +38,10 @@ import qualified Data.Map.Monoidal as MonoidalMap
import Data.Semigroup (Semigroup(..))
import Foreign.Storable
import Data.Void
#if MIN_VERSION_patch(0,0,7)
import Data.Semigroup.Additive
import Data.Semigroup.Commutative
#endif
import Data.Monoid hiding ((<>))
import Control.Applicative

Expand Down Expand Up @@ -123,7 +127,11 @@ instance Monoid SelectedCount where
instance Group SelectedCount where
negateG (SelectedCount a) = SelectedCount (negate a)

#if MIN_VERSION_patch(0,0,7)
instance Commutative SelectedCount
#else
instance Additive SelectedCount
#endif

-- | The Semigroup\/Monoid\/Group instances for a Query containing 'SelectedCount's should use
-- this function which returns Nothing if the result is 0. This allows the pruning of leaves
Expand Down

0 comments on commit 3ce55d4

Please sign in to comment.