-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Intervals with adherences.
--
-- Data types to represent, compare and combine intervals with
-- adherences.
--
-- See also:
--
--
@package interval
@version 1.20160821
module Data.Interval
data Limit x
Limit :: Adherence -> x -> Limit x
[adherence] :: Limit x -> Adherence
[limit] :: Limit x -> x
data Adherence
Out :: Adherence
In :: Adherence
-- | Return given Limit with its adherence set to the
-- opposite one.
flip_limit :: Limit x -> Limit x
-- | Compare two low Limits.
newtype LL x
LL :: x -> LL x
[unLL] :: LL x -> x
-- | Compare two high Limits.
newtype HH x
HH :: x -> HH x
[unHH] :: HH x -> x
newtype Ord x => Interval x
Interval :: (Limit x, Limit x) -> Interval x
low :: Ord x => Interval x -> Limit x
high :: Ord x => Interval x -> Limit x
-- | Return Interval with given low then high
-- Limits, if they form a valid Interval.
interval :: Ord x => Limit x -> Limit x -> Maybe (Interval x)
-- | Like fmap, but may return Nothing, if mapped
-- Interval is not valid.
fmap :: (Ord x, Ord y) => (x -> y) -> Interval x -> Maybe (Interval y)
-- | Like fmap, but only safe if given map preserves
-- Ordering.
fmap_unsafe :: (Ord x, Ord y) => (x -> y) -> Interval x -> Interval y
-- | Lexicographical order, handling Adherence correctly.
-- | Return limits of given Interval as a tuple.
limits :: Ord x => Interval x -> (Limit x, Limit x)
-- | Return an Interval spanning over a single limit.
point :: Ord x => x -> Interval x
-- | Return given Interval with flip_limit applied to its
-- limits.
flip_limits :: Ord x => Interval x -> Interval x
-- | Return Ordering comparing given Intervals according to
-- their limits.
compare_without_adherence :: Ord x => Limit x -> Limit x -> Ordering
-- | Return:
--
--
-- - LT: if given value is lower than all values in given
-- Interval.
-- - EQ: if given value is into the given Interval.
-- - GT: if given value is higher than all values in given
-- Interval.
--
locate :: Ord x => x -> Interval x -> Ordering
-- | Return True iif. given value is into the given Interval.
within :: Ord x => x -> Interval x -> Bool
-- | Return True iif. every value of the first Interval is
-- into the second Interval.
into :: Ord x => Interval x -> Interval x -> Bool
-- | Return True iif. every value of the second Interval is
-- into the first Interval.
onto :: Ord x => Interval x -> Interval x -> Bool
(<=..<=) :: Ord x => x -> x -> Maybe (Interval x)
infix 5 <=..<=
(<..<=) :: Ord x => x -> x -> Maybe (Interval x)
infix 5 <..<=
(<=..<) :: Ord x => x -> x -> Maybe (Interval x)
infix 5 <=..<
(<..<) :: Ord x => x -> x -> Maybe (Interval x)
infix 5 <..<
data Position
-- | -_| (LT) or |_- (GT)
Away :: Position
-- | -| (LT) or |- (GT)
Adjacent :: Position
-- | -+| (LT) or |+- (GT)
Overlap :: Position
-- | +| (LT) or +- (GT)
Prefix :: Position
-- | -+ (LT) or |+ (GT)
Suffixed :: Position
-- | -+- (LT) or |+| (GT)
Include :: Position
-- | + (EQ)
Equal :: Position
position :: Ord x => Interval x -> Interval x -> (Position, Ordering)
-- | Return True iif. Position of given Intervals is
-- (Away, LT).
(..<<..) :: Ord x => Interval x -> Interval x -> Bool
infix 4 ..<<..
-- | Return True iif. Position of given Intervals is
-- (Away, GT).
(..>>..) :: Ord x => Interval x -> Interval x -> Bool
infix 4 ..>>..
-- | Return True iif. Position of given Intervals is
-- (Away, LT) or (Adjacent, LT).
(..<..) :: Ord x => Interval x -> Interval x -> Bool
infix 4 ..<..
-- | Return True iif. Position of given Intervals is
-- (Away, GT) or (Adjacent, GT).
(..>..) :: Ord x => Interval x -> Interval x -> Bool
infix 4 ..>..
-- | Return True iif. Position of given Intervals is
-- (Away, LT), (Adjacent, LT),
-- (Overlap, LT), (Prefix, LT),
-- (Suffixed, LT), (Include, GT), or
-- (Equal, _).
(..<=..) :: Ord x => Interval x -> Interval x -> Bool
infix 4 ..<=..
-- | Return True iif. Position of given Intervals is
-- (Away, GT), (Adjacent, GT),
-- (Overlap, GT), (Prefix, GT),
-- (Suffixed, GT), (Include, LT), or
-- (Equal, _).
(..>=..) :: Ord x => Interval x -> Interval x -> Bool
infix 4 ..>=..
union :: Ord x => Interval x -> Interval x -> Maybe (Interval x)
intersection :: Ord x => Interval x -> Interval x -> Maybe (Interval x)
span :: Ord x => Interval x -> Interval x -> Interval x
data Unlimitable x
Unlimited_low :: Unlimitable x
Limited :: x -> Unlimitable x
[limited] :: Unlimitable x -> x
Unlimited_high :: Unlimitable x
unlimited :: Ord x => Interval (Unlimitable x)
unlimit :: Ord x => Interval x -> Interval (Unlimitable x)
(<..) :: Ord x => x -> Interval (Unlimitable x)
(<=..) :: Ord x => x -> Interval (Unlimitable x)
(..<) :: Ord x => x -> Interval (Unlimitable x)
(..<=) :: Ord x => x -> Interval (Unlimitable x)
newtype Pretty x
Pretty :: x -> Pretty x
instance GHC.Classes.Ord x => GHC.Classes.Ord (Data.Interval.Pretty x)
instance GHC.Classes.Eq x => GHC.Classes.Eq (Data.Interval.Pretty x)
instance GHC.Show.Show x => GHC.Show.Show (Data.Interval.Unlimitable x)
instance GHC.Classes.Ord x => GHC.Classes.Ord (Data.Interval.Unlimitable x)
instance GHC.Classes.Eq x => GHC.Classes.Eq (Data.Interval.Unlimitable x)
instance GHC.Show.Show Data.Interval.Position
instance GHC.Classes.Eq Data.Interval.Position
instance (Data.Data.Data x, GHC.Classes.Ord x) => Data.Data.Data (Data.Interval.Interval x)
instance (GHC.Classes.Ord x, GHC.Show.Show x) => GHC.Show.Show (Data.Interval.Interval x)
instance GHC.Classes.Eq x => GHC.Classes.Eq (Data.Interval.Interval x)
instance GHC.Classes.Eq x => GHC.Classes.Eq (Data.Interval.HH x)
instance GHC.Classes.Eq x => GHC.Classes.Eq (Data.Interval.LL x)
instance GHC.Show.Show x => GHC.Show.Show (Data.Interval.Limit x)
instance Data.Data.Data x => Data.Data.Data (Data.Interval.Limit x)
instance GHC.Classes.Eq x => GHC.Classes.Eq (Data.Interval.Limit x)
instance GHC.Show.Show Data.Interval.Adherence
instance Data.Data.Data Data.Interval.Adherence
instance GHC.Classes.Eq Data.Interval.Adherence
instance GHC.Base.Functor Data.Interval.Limit
instance Control.DeepSeq.NFData x => Control.DeepSeq.NFData (Data.Interval.Limit x)
instance GHC.Classes.Ord x => GHC.Classes.Ord (Data.Interval.LL (Data.Interval.Limit x))
instance GHC.Classes.Ord x => GHC.Classes.Ord (Data.Interval.HH (Data.Interval.Limit x))
instance (Control.DeepSeq.NFData x, GHC.Classes.Ord x) => Control.DeepSeq.NFData (Data.Interval.Interval x)
instance GHC.Classes.Ord x => GHC.Classes.Ord (Data.Interval.Interval x)
instance GHC.Base.Functor Data.Interval.Unlimitable
instance GHC.Enum.Bounded (Data.Interval.Unlimitable x)
instance GHC.Enum.Bounded (Data.Interval.Limit (Data.Interval.Unlimitable x))
instance (GHC.Classes.Ord x, GHC.Show.Show x) => GHC.Show.Show (Data.Interval.Pretty (Data.Interval.Interval x))
instance (GHC.Classes.Ord x, GHC.Show.Show x) => GHC.Show.Show (Data.Interval.Pretty (Data.Interval.Unlimitable x))
module Data.Interval.Sieve
-- | ..<<..-ordered union of Intervals.
--
-- Ressources:
--
--
newtype Sieve x
Sieve :: FingerTree (Measure x) (Interval x) -> Sieve x
[unSieve] :: Sieve x -> FingerTree (Measure x) (Interval x)
-- | Like fmap but working on Intervals.
fmap_interval :: (Ord x, Ord y) => (Interval x -> Interval y) -> Sieve x -> Sieve y
-- | Like fmap but working on Intervals, and safe only if
-- Measure is preserved.
fmap_interval_unsafe :: Ord x => (Interval x -> Interval x) -> Sieve x -> Sieve x
-- | Like traverse but working on Intervals.
traverse_interval :: (Ord x, Ord y, Applicative f) => (Interval x -> f (Interval y)) -> Sieve x -> f (Sieve y)
-- | Like traverse but working on Intervals, and safe only if
-- Measure is preserved.
traverse_interval_unsafe :: (Ord x, Applicative f) => (Interval x -> f (Interval x)) -> Sieve x -> f (Sieve x)
-- | Measure of each leaf or node of the Sieve
-- FingerTree.
data Measure x
-- | Measure of empty Fingertree.
Measure_Empty :: Measure x
Measure :: Interval x -> Measure x
-- | An Interval with the max high Limit
-- amongst those having the max low Limit (which
-- is the max Interval because of lexicographical
-- ordering).
[max_high_of_max_low] :: Measure x -> Interval x
empty :: Ord x => Sieve x
-- | Return the True iif. the given Sieve is empty.
null :: Ord x => Sieve x -> Bool
singleton :: Ord x => Interval x -> Sieve x
-- | Return an Interval with:
--
--
interval :: Ord x => Sieve x -> Maybe (Interval x)
-- | All the Intervals of the Sieve in ..<<..
-- order.
intervals :: Ord x => Sieve x -> [Interval x]
-- | Return a Sieve merging the given Sieves with
-- union.
union :: Ord x => Sieve x -> Sieve x -> Sieve x
-- | Return a Sieve merging the Intervals in the given
-- Foldable with union.
from_Foldable :: (Foldable f, Ord x) => f (Interval x) -> Sieve x
-- | Return a Sieve merging the given Sieves with
-- intersection.
intersection :: Ord x => Sieve x -> Sieve x -> Sieve x
-- | All Intervals having a non-Nothing intersection
-- with the given Interval, in ..<<.. order.
intersecting :: Ord x => Interval x -> Sieve x -> [Interval x]
-- | Return the Sieve spanning over all the values not within the
-- given Sieve.
complement :: (Ord x, Bounded (Limit x)) => Sieve x -> Sieve x
-- | Return the Sieve spanning over all the values not within the
-- given Sieve, but within the given Interval which MUST be
-- onto every Interval inside the Sieve.
complement_with :: Ord x => Interval x -> Sieve x -> Sieve x
instance (GHC.Classes.Ord x, GHC.Show.Show x) => GHC.Show.Show (Data.Interval.Pretty (Data.Interval.Sieve.Sieve x))
instance GHC.Classes.Ord x => GHC.Base.Monoid (Data.Interval.Sieve.Measure x)
instance GHC.Classes.Ord x => Data.FingerTree.Measured (Data.Interval.Sieve.Measure x) (Data.Interval.Interval x)