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 Jan 2, 2022
1 parent 785e482 commit 316d3e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion groups.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ source-repository head
library
exposed-modules: Data.Group
-- other-modules:
build-depends: base >= 4.6 && < 5
hs-source-dirs: src
default-language: Haskell2010
build-depends: base >= 4.6 && < 5

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 @@ -197,7 +197,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 @@ -214,6 +213,7 @@ instance (Abelian (f a), Abelian (g a)) => Abelian ((f :*: g) a)

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

#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 316d3e5

Please sign in to comment.