IntervalMap-0.4.0.1: Maps from Intervals to values, with efficient search.

Portabilitynon-portable (MPTC with FD)
Stabilityexperimental
Maintainerchbreitkopf@gmail.com
Safe HaskellSafe-Inferred

Data.IntervalMap.Generic.Interval

Contents

Description

Type class for IntervalMap keys.

As there is no sensible default, no instances for prelude types are provided (E.g. you might want to have tuples as closed intervals in one case, and open in another).

Synopsis

Interval type

class Ord e => Interval i e | i -> e whereSource

Intervals with endpoints of type e. A minimal instance declaration for a closed interval needs only to define lowerBound and upperBound.

Methods

lowerBound :: i -> eSource

lower bound

upperBound :: i -> eSource

upper bound

leftClosed :: i -> BoolSource

Does the interval include its lower bound? Default is True for all values, i.e. closed intervals.

rightClosed :: i -> BoolSource

Does the interval include its upper bound bound? Default is True for all values, i.e. closed intervals.

before :: i -> i -> BoolSource

Interval strictly before another? True if the upper bound of the first interval is below the lower bound of the second.

after :: i -> i -> BoolSource

Interval strictly after another? Same as 'flip before'.

subsumes :: i -> i -> BoolSource

Does the first interval completely contain the second?

overlaps :: i -> i -> BoolSource

Do the two intervals overlap?

below :: e -> i -> BoolSource

Is a point strictly less than lower bound?

above :: e -> i -> BoolSource

Is a point strictly greater than upper bound?

inside :: e -> i -> BoolSource

Does the interval contain a given point?

isEmpty :: i -> BoolSource

Is the interval empty?

Instances

Ord a => Interval (Interval a) a 

helper functions for declaring Eq and Ord instances

genericEquals :: (Interval i e, Eq e) => i -> i -> BoolSource

genericCompare :: (Interval i e, Ord e) => i -> i -> OrderingSource