-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Interval arithmetic for both open and closed intervals
--
-- Unlike the intervals package
-- (http://hackage.haskell.org/package/intervals), this package
-- provides both open and closed intervals and is intended to be used
-- with Rational.
@package data-interval
@version 0.3.0
-- | Interval datatype and interval arithmetic.
--
-- Unlike the intervals package
-- (http://hackage.haskell.org/package/intervals), this module
-- provides both open and closed intervals and is intended to be used
-- with Rational.
--
-- For the purpose of abstract interpretation, it might be convenient to
-- use Lattice instance. See also lattices package
-- (http://hackage.haskell.org/package/lattices).
module Data.Interval
-- | Interval
data Interval r
-- | Endpoints of intervals
data EndPoint r
-- | negative infinity (-∞)
NegInf :: EndPoint r
-- | finite value
Finite :: !r -> EndPoint r
-- | positive infinity (+∞)
PosInf :: EndPoint r
-- | smart constructor for Interval
interval :: (Ord r, Num r) => (EndPoint r, Bool) -> (EndPoint r, Bool) -> Interval r
-- | closed interval [l,u]
(<=..<=) :: (Ord r, Num r) => EndPoint r -> EndPoint r -> Interval r
-- | left-open right-closed interval (l,u]
(<..<=) :: (Ord r, Num r) => EndPoint r -> EndPoint r -> Interval r
-- | left-closed right-open interval [l, u)
(<=..<) :: (Ord r, Num r) => EndPoint r -> EndPoint r -> Interval r
-- | open interval (l, u)
(<..<) :: (Ord r, Num r) => EndPoint r -> EndPoint r -> Interval r
-- | whole real number line (-∞, ∞)
whole :: (Num r, Ord r) => Interval r
-- | empty (contradicting) interval
empty :: Num r => Interval r
-- | singleton set [x,x]
singleton :: (Num r, Ord r) => r -> Interval r
-- | Is the interval empty?
null :: Ord r => Interval r -> Bool
-- | Is the element in the interval?
member :: Ord r => r -> Interval r -> Bool
-- | Is the element not in the interval?
notMember :: Ord r => r -> Interval r -> Bool
-- | Is this a subset? (i1 isSubsetOf i2) tells whether
-- i1 is a subset of i2.
isSubsetOf :: Ord r => Interval r -> Interval r -> Bool
-- | Is this a proper subset? (ie. a subset but not equal).
isProperSubsetOf :: Ord r => Interval r -> Interval r -> Bool
-- | Lower bound of the interval
lowerBound :: Num r => Interval r -> EndPoint r
-- | Upper bound of the interval
upperBound :: Num r => Interval r -> EndPoint r
-- | Lower bound of the interval and whether it is included in the
-- interval. The result is convenient to use as an argument for
-- interval.
lowerBound' :: Num r => Interval r -> (EndPoint r, Bool)
-- | Upper bound of the interval and whether it is included in the
-- interval. The result is convenient to use as an argument for
-- interval.
upperBound' :: Num r => Interval r -> (EndPoint r, Bool)
-- | Width of a interval. Width of an unbounded interval is
-- undefined.
width :: (Num r, Ord r) => Interval r -> r
-- | For all x in X, y in Y. x
-- < y
( Interval r -> Interval r -> Bool
-- | For all x in X, y in Y. x
-- <= y
(<=!) :: Real r => Interval r -> Interval r -> Bool
-- | For all x in X, y in Y. x
-- == y
(==!) :: Real r => Interval r -> Interval r -> Bool
-- | For all x in X, y in Y. x
-- >= y
(>=!) :: Real r => Interval r -> Interval r -> Bool
-- | For all x in X, y in Y. x
-- > y
(>!) :: Real r => Interval r -> Interval r -> Bool
-- | Does there exist an x in X, y in Y
-- such that x < y?
() :: Real r => Interval r -> Interval r -> Bool
-- | Does there exist an x in X, y in Y
-- such that x <= y?
(<=?) :: Real r => Interval r -> Interval r -> Bool
-- | Does there exist an x in X, y in Y
-- such that x == y?
(==?) :: Real r => Interval r -> Interval r -> Bool
-- | Does there exist an x in X, y in Y
-- such that x >= y?
(>=?) :: Real r => Interval r -> Interval r -> Bool
-- | Does there exist an x in X, y in Y
-- such that x > y?
(>?) :: Real r => Interval r -> Interval r -> Bool
-- | intersection of two intervals
intersection :: (Ord r, Num r) => Interval r -> Interval r -> Interval r
-- | convex hull of two intervals
hull :: (Ord r, Num r) => Interval r -> Interval r -> Interval r
-- | pick up an element from the interval if the interval is not empty.
pickup :: (Real r, Fractional r) => Interval r -> Maybe r
instance Typeable1 EndPoint
instance Typeable1 Interval
instance Ord r => Ord (EndPoint r)
instance Eq r => Eq (EndPoint r)
instance Show r => Show (EndPoint r)
instance Read r => Read (EndPoint r)
instance Data r => Data (EndPoint r)
instance Eq r => Eq (Interval r)
instance Hashable r => Hashable (EndPoint r)
instance NFData r => NFData (EndPoint r)
instance Functor EndPoint
instance Bounded (EndPoint r)
instance (Real r, Fractional r) => Fractional (Interval r)
instance (Num r, Ord r) => Num (Interval r)
instance (Num r, Ord r, Data r) => Data (Interval r)
instance (Num r, Ord r, Read r) => Read (Interval r)
instance (Num r, Ord r, Show r) => Show (Interval r)
instance (Num r, Ord r) => BoundedLattice (Interval r)
instance (Num r, Ord r) => BoundedMeetSemiLattice (Interval r)
instance (Num r, Ord r) => BoundedJoinSemiLattice (Interval r)
instance (Num r, Ord r) => Lattice (Interval r)
instance (Num r, Ord r) => MeetSemiLattice (Interval r)
instance (Num r, Ord r) => JoinSemiLattice (Interval r)
instance Hashable r => Hashable (Interval r)
instance NFData r => NFData (Interval r)