diff --git a/Algebra.hs b/Algebra.hs
--- a/Algebra.hs
+++ b/Algebra.hs
@@ -1,6 +1,3 @@
-{-# LANGUAGE FlexibleContexts #-}
-{-# LANGUAGE FlexibleInstances #-}
-
 module Algebra (Semigroup (..), Monoid (mempty), Group (..), Abelian, Idempotent,
                 (+), (-), (*), (/), (×), commuteWith) where
 
diff --git a/Data/BitSet.hs b/Data/BitSet.hs
--- a/Data/BitSet.hs
+++ b/Data/BitSet.hs
@@ -1,5 +1,3 @@
-{-# LANGUAGE FlexibleInstances #-}
-
 module Data.BitSet where
 
 import Control.Applicative
diff --git a/Relation/Binary/Comparison.hs b/Relation/Binary/Comparison.hs
--- a/Relation/Binary/Comparison.hs
+++ b/Relation/Binary/Comparison.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE FlexibleContexts, FlexibleInstances #-}
+{-# LANGUAGE ViewPatterns #-}
 
 module Relation.Binary.Comparison where
 
@@ -16,6 +16,7 @@
 import Data.Maybe
 import Data.Monoid (Sum (..))
 import Data.Ord (Down (..), Ordering (..))
+import Data.Ratio
 import Data.Word
 import Numeric.Natural
 
@@ -270,3 +271,6 @@
 
 instance {-# OVERLAPPABLE #-} Ord a => Semigroup (Max a) where Max a <> Max b = Max (max a b)
 instance {-# OVERLAPPABLE #-} Ord a => Semigroup (Min a) where Min a <> Min b = Min (min a b)
+
+instance PartialEq a => PartialEq (Ratio a) where
+    (≡) = (≡) `on` liftA2 (,) numerator denominator
diff --git a/alg.cabal b/alg.cabal
--- a/alg.cabal
+++ b/alg.cabal
@@ -1,5 +1,5 @@
 name:                alg
-version:             0.2.6.0
+version:             0.2.7.0
 synopsis:            Algebraic structures
 -- description:         
 license:             BSD3
@@ -29,6 +29,8 @@
                      , PartialTypeSignatures
                      , TypeOperators
                      , PolyKinds
+                     , FlexibleContexts
+                     , FlexibleInstances
                      , StandaloneDeriving
                      , GeneralizedNewtypeDeriving
   ghc-options:         -Wall -Wcompat -Wredundant-constraints -Wno-partial-type-signatures
