connections-0.3.2: Orders, Galois connections, and lattices.

Safe HaskellSafe
LanguageHaskell2010

Data.Order.Interval

Synopsis

Documentation

data Interval a Source #

An interval in a poset P.

An interval in a poset P is a subset I of P with the following property:

\( \forall x, y \in I, z \in P: x \leq z \leq y \Rightarrow z \in I \)

Instances
Eq a => Eq (Interval a) Source # 
Instance details

Defined in Data.Order.Interval

Methods

(==) :: Interval a -> Interval a -> Bool #

(/=) :: Interval a -> Interval a -> Bool #

Show a => Show (Interval a) Source # 
Instance details

Defined in Data.Order.Interval

Methods

showsPrec :: Int -> Interval a -> ShowS #

show :: Interval a -> String #

showList :: [Interval a] -> ShowS #

Preorder a => Preorder (Interval a) Source #

A containment order

Instance details

Defined in Data.Order.Interval

imap :: Preorder b => (a -> b) -> Interval a -> Interval b Source #

Map over an interval.

Note this is not a functor, as a non-monotonic map may cause the interval to collapse to the iempty interval.

(...) :: Preorder a => a -> a -> Interval a infix 3 Source #

Construct an interval from a pair of points.

Note: Endpoints are preorder-sorted. If pcompare x y = Nothing then the resulting interval will be empty.

iempty :: Interval a Source #

The iempty interval.

>>> iempty
Empty

singleton :: a -> Interval a Source #

Construct an interval containing a single point.

>>> singleton 1
1 ... 1

endpts :: Interval a -> Maybe (a, a) Source #

Obtain the endpoints of an interval.