From f34b1b7d0f6189e498817903b67c408d035bbf92 Mon Sep 17 00:00:00 2001 From: Julien Moutinho Date: Sat, 10 Dec 2016 23:19:58 +0100 Subject: [PATCH] Remove redundant Ord constraints. --- Data/Interval.hs | 2 +- Data/Interval/Sieve.hs | 22 ++++++++++------------ interval.cabal | 4 ++-- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/Data/Interval.hs b/Data/Interval.hs index 5a3b67c..d8b98c4 100644 --- a/Data/Interval.hs +++ b/Data/Interval.hs @@ -433,7 +433,7 @@ instance (Ord x, Show x) => Show (Pretty (Interval x)) where In -> "]" Out -> "[" ] -instance (Ord x, Show x) => Show (Pretty (Unlimitable x)) where +instance Show x => Show (Pretty (Unlimitable x)) where show (Pretty x) = case x of Unlimited_low -> "-oo" diff --git a/Data/Interval/Sieve.hs b/Data/Interval/Sieve.hs index 9225f2e..183e068 100644 --- a/Data/Interval/Sieve.hs +++ b/Data/Interval/Sieve.hs @@ -51,21 +51,19 @@ instance (Ord x, Show x) => Show (Pretty (Sieve x)) where -- | Like 'Data.Functor.fmap' but working on 'Interval's. fmap_interval - :: (Ord x, Ord y) - => (Interval x -> Interval y) -> Sieve x -> Sieve y + :: (Interval x -> Interval y) -> Sieve x -> Sieve y fmap_interval f (Sieve ft) = Sieve (FT.fmap' f ft) -- | Like 'Data.Functor.fmap' but working on 'Interval's, -- and safe only if 'Measure' is preserved. fmap_interval_unsafe - :: Ord x - => (Interval x -> Interval x) + :: (Interval x -> Interval x) -> Sieve x -> Sieve x fmap_interval_unsafe f (Sieve ft) = Sieve (FT.unsafeFmap f ft) -- | Like 'Data.Traversable.traverse' but working on 'Interval's. traverse_interval - :: (Ord x, Ord y, Applicative f) + :: Applicative f => (Interval x -> f (Interval y)) -> Sieve x -> f (Sieve y) traverse_interval f (Sieve ft) = Sieve <$> FT.traverse' f ft @@ -73,7 +71,7 @@ traverse_interval f (Sieve ft) = Sieve <$> FT.traverse' f ft -- | Like 'Data.Traversable.traverse' but working on 'Interval's, -- and safe only if 'Measure' is preserved. traverse_interval_unsafe - :: (Ord x, Applicative f) + :: Applicative f => (Interval x -> f (Interval x)) -> Sieve x -> f (Sieve x) traverse_interval_unsafe f (Sieve ft) = Sieve <$> FT.unsafeTraverse f ft @@ -95,7 +93,7 @@ data Measure x -- and thus not be the 'max' 'Interval'). -} } -instance Ord x => Monoid (Measure x) where +instance Monoid (Measure x) where mempty = Measure_Empty Measure_Empty `mappend` i = i @@ -114,17 +112,17 @@ instance Ord x => Monoid (Measure x) where (Out, Out) -> max_high i GT -> max_high i -} -instance Ord x => FT.Measured (Measure x) (Interval x) where +instance FT.Measured (Measure x) (Interval x) where measure = Measure -empty :: Ord x => Sieve x +empty :: Sieve x empty = Sieve FT.empty -- | Return the 'True' iif. the given 'Sieve' is 'empty'. -null :: Ord x => Sieve x -> Bool +null :: Sieve x -> Bool null (Sieve ft) = FT.null ft -singleton :: Ord x => Interval x -> Sieve x +singleton :: Interval x -> Sieve x singleton = Sieve . FT.singleton -- | Return an 'Interval' with: @@ -142,7 +140,7 @@ interval (Sieve ft) = _ :> r -> Just $ Interval (low l, high r) -- | All the 'Interval's of the 'Sieve' in '..<<..' order. -intervals :: Ord x => Sieve x -> [Interval x] +intervals :: Sieve x -> [Interval x] intervals (Sieve t) = Foldable.toList t -- * Union diff --git a/interval.cabal b/interval.cabal index 1d05b02..dba2983 100644 --- a/interval.cabal +++ b/interval.cabal @@ -21,8 +21,8 @@ maintainer: Julien Moutinho name: interval stability: experimental synopsis: Intervals with adherences. -tested-with: GHC==7.10.3 -version: 1.20160826 +tested-with: GHC==8.0.1 +version: 1.20161210 source-repository head location: git://git.autogeree.net/haskell/interval -- 2.44.1