-- | 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
-- | 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
-- 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
(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:
_ :> 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