Safe Haskell | None |
---|---|
Language | Haskell2010 |
A type for intervals and associated functions.
Synopsis
-
data
Interval
a =
Interval
{
- ivFrom :: LowerBound a
- ivTo :: UpperBound a
- data UpperBound a = UpperBound ( Extended a) Closure
- data LowerBound a = LowerBound ( Extended a) Closure
- data Extended a
- type Closure = Bool
- member :: Ord a => a -> Interval a -> Bool
- interval :: a -> a -> Interval a
- from :: a -> Interval a
- to :: a -> Interval a
- always :: Interval a
- never :: Interval a
- singleton :: a -> Interval a
- hull :: Ord a => Interval a -> Interval a -> Interval a
- intersection :: Ord a => Interval a -> Interval a -> Interval a
- overlaps :: ( Enum a, Ord a) => Interval a -> Interval a -> Bool
- contains :: Ord a => Interval a -> Interval a -> Bool
- isEmpty :: ( Enum a, Ord a) => Interval a -> Bool
- before :: Ord a => a -> Interval a -> Bool
- after :: Ord a => a -> Interval a -> Bool
- lowerBound :: a -> LowerBound a
- upperBound :: a -> UpperBound a
- strictLowerBound :: a -> LowerBound a
- strictUpperBound :: a -> UpperBound a
Documentation
An interval of
a
s.
The interval may be either closed or open at either end, meaning that the endpoints may or may not be included in the interval.
The interval can also be unbounded on either side.
Interval | |
|
Instances
data UpperBound a Source #
The upper bound of an interval.
UpperBound ( Extended a) Closure |
Instances
data LowerBound a Source #
The lower bound of an interval.
LowerBound ( Extended a) Closure |
Instances
A set extended with a positive and negative infinity.
Instances
interval :: a -> a -> Interval a Source #
interval a b
includes all values that are greater than or equal to
a
and smaller than or equal to
b
. Therefore it includes
a
and
b
.
from :: a -> Interval a Source #
from a
is an
Interval
that includes all values that are
greater than or equal to
a
.
to :: a -> Interval a Source #
to a
is an
Interval
that includes all values that are
smaller than or equal to
a
.
hull :: Ord a => Interval a -> Interval a -> Interval a Source #
'hull a b' is the smallest interval containing
a
and
b
.
intersection :: Ord a => Interval a -> Interval a -> Interval a Source #
'intersection a b' is the largest interval that is contained in
a
and in
b
, if it exists.
overlaps :: ( Enum a, Ord a) => Interval a -> Interval a -> Bool Source #
Check whether two intervals overlap, that is, whether there is a value that is a member of both intervals.
before :: Ord a => a -> Interval a -> Bool Source #
Check if a value is earlier than the beginning of an
Interval
.
after :: Ord a => a -> Interval a -> Bool Source #
Check if a value is later than the end of a
Interval
.
lowerBound :: a -> LowerBound a Source #
upperBound :: a -> UpperBound a Source #
strictLowerBound :: a -> LowerBound a Source #
strictUpperBound :: a -> UpperBound a Source #