Skip to content

Commit 316d3e5

Browse files
committed
Use base-orphans to make the GHC.Generics instances unconditional
Fixes #8
1 parent 785e482 commit 316d3e5

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

groups.cabal

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ source-repository head
1919
library
2020
exposed-modules: Data.Group
2121
-- other-modules:
22-
build-depends: base >= 4.6 && < 5
2322
hs-source-dirs: src
2423
default-language: Haskell2010
24+
build-depends: base >= 4.6 && < 5
25+
26+
if impl(ghc < 8.6) -- really, if base < 8.12
27+
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
@@ -197,7 +197,6 @@ instance Cyclic a => Cyclic (Identity a) where
197197
-- (:*:) and (:.:) exist since base-4.6.0.0 but the Monoid instances
198198
-- arrive in base-4.12.0.0.
199199
-- Also, contravariant was moved into base in this version.
200-
#if MIN_VERSION_base(4,12,0)
201200
-- | Product of groups, Functor style.
202201
instance (Group (f a), Group (g a)) => Group ((f :*: g) a) where
203202
invert (a :*: b) = invert a :*: invert b
@@ -214,6 +213,7 @@ instance (Abelian (f a), Abelian (g a)) => Abelian ((f :*: g) a)
214213

215214
instance Abelian (f (g a)) => Abelian ((f :.: g) a)
216215

216+
#if MIN_VERSION_base(4,12,0)
217217
instance Group a => Group (Op a b) where
218218
invert (Op f) = Op (invert f)
219219
pow (Op f) n = Op (\e -> pow (f e) n)

0 commit comments

Comments
 (0)