Skip to content

Commit 5a2ad08

Browse files
committed
Use base-orphans to make the GHC.Generics instances unconditional
Fixes #8
1 parent dcc1177 commit 5a2ad08

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

groups.cabal

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ source-repository head
2222
library
2323
exposed-modules: Data.Group
2424
-- other-modules:
25-
build-depends: base >= 4.6 && < 5
26-
, commutative-semigroups >= 0.0 && < 0.1
2725
hs-source-dirs: src
2826
default-language: Haskell2010
27+
28+
build-depends: base >= 4.6 && < 5
29+
, commutative-semigroups >= 0.0 && < 0.1
30+
31+
if impl(ghc < 8.6) -- really, if base < 8.12
32+
build-depends: base-orphans >= 0.8 && < 0.9

src/Data/Group.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ instance Cyclic a => Cyclic (Identity a) where
171171
-- (:*:) and (:.:) exist since base-4.6.0.0 but the Monoid instances
172172
-- arrive in base-4.12.0.0.
173173
-- Also, contravariant was moved into base in this version.
174-
#if MIN_VERSION_base(4,12,0)
175174
-- | Product of groups, Functor style.
176175
instance (Group (f a), Group (g a)) => Group ((f :*: g) a) where
177176
invert (a :*: b) = invert a :*: invert b
@@ -184,6 +183,7 @@ instance Group (f (g a)) => Group ((f :.: g) a) where
184183
invert (Comp1 xs) = Comp1 (invert xs)
185184
Comp1 xs ~~ Comp1 ys = Comp1 (xs ~~ ys)
186185

186+
#if MIN_VERSION_base(4,12,0)
187187
instance Group a => Group (Op a b) where
188188
invert (Op f) = Op (invert f)
189189
pow (Op f) n = Op (\e -> pow (f e) n)

0 commit comments

Comments
 (0)