Skip to content

Commit

Permalink
Use base-orphans to make the GHC.Generics instances unconditional
Browse files Browse the repository at this point in the history
Fixes Taneb#8
  • Loading branch information
Ericson2314 committed Jun 8, 2022
1 parent dcc1177 commit 5a2ad08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions groups.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ source-repository head
library
exposed-modules: Data.Group
-- other-modules:
build-depends: base >= 4.6 && < 5
, commutative-semigroups >= 0.0 && < 0.1
hs-source-dirs: src
default-language: Haskell2010

build-depends: base >= 4.6 && < 5
, commutative-semigroups >= 0.0 && < 0.1

if impl(ghc < 8.6) -- really, if base < 8.12
build-depends: base-orphans >= 0.8 && < 0.9
2 changes: 1 addition & 1 deletion src/Data/Group.hs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ instance Cyclic a => Cyclic (Identity a) where
-- (:*:) and (:.:) exist since base-4.6.0.0 but the Monoid instances
-- arrive in base-4.12.0.0.
-- Also, contravariant was moved into base in this version.
#if MIN_VERSION_base(4,12,0)
-- | Product of groups, Functor style.
instance (Group (f a), Group (g a)) => Group ((f :*: g) a) where
invert (a :*: b) = invert a :*: invert b
Expand All @@ -184,6 +183,7 @@ instance Group (f (g a)) => Group ((f :.: g) a) where
invert (Comp1 xs) = Comp1 (invert xs)
Comp1 xs ~~ Comp1 ys = Comp1 (xs ~~ ys)

#if MIN_VERSION_base(4,12,0)
instance Group a => Group (Op a b) where
invert (Op f) = Op (invert f)
pow (Op f) n = Op (\e -> pow (f e) n)
Expand Down

0 comments on commit 5a2ad08

Please sign in to comment.