Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Representation of an interval on a single dimension
- interval :: Ord a => (a, Bool) -> (a, Bool) -> Interval a
- (<=..<=) :: Ord a => a -> a -> Interval a
- (<..<=) :: Ord a => a -> a -> Interval a
- (<=..<) :: Ord a => a -> a -> Interval a
- (<..<) :: Ord a => a -> a -> Interval a
- singleton :: Ord a => a -> Interval a
- empty :: Ord a => Interval a
- fromList :: Ord a => [a] -> Interval a
- intervalHead :: Interval a -> Maybe a
- null :: Ord a => Interval a -> Bool
- member :: Ord a => a -> Interval a -> Bool
- data Interval a = Interval {}
Documentation
(<..<=) :: Ord a => a -> a -> Interval a infix 5 Source #
make a left-open, right-closed interval (l,u]
(<=..<) :: Ord a => a -> a -> Interval a infix 5 Source #
make a left-closed, right-open interval [l, u)
fromList :: Ord a => [a] -> Interval a Source #
make an interval from a list
Making an interval from a single value [15] yields the singleton interval.
Making an interval from a longer list of values [a, b, c, ..., d] will build a closed interval containing all of the values in the list.
intervalHead :: Interval a -> Maybe a Source #
return the "head" of an interval. If the interval is empty, return Nothing. Return the starting element if that is present, and the ending element otherwise.
A representation of a bounded interval. This covers all of the possible interval types, including one that starts but has no end, one that ends but has no start, one that is bounded, and one that is exact. Inclusiveness flags are included for both the start and the end.
Functor Interval Source # | |
Show a => Show (Interval a) Source # | |
Ord a => Monoid (Interval a) Source # | This monoid instance defines the rules for combining two different intervals, and it handles all interval combination types. The end result follows these rules:
|