r-k-b / elm-interval / Union

A set of strictly ordered, fully disjoint Intervals.

Types


type Union

A set of strictly non-overlapping Intervals.

Opaque type; do not export.

Constructors

fromInterval : Interval -> Union

Construct a "union" from a single Interval.

fromIntervals : List Interval -> Union

Additively construct a union from an unordered list of arbitrary Intervals.

Operations on Unions

union : Union -> Union -> Union

Merge two Unions. E.g.:

unionOfIntervals : Interval -> Interval -> Union

Construct a Union from the additive merger of two Intervals. E.g.:

intersection : Union -> Union -> Union

Return the intersection of two Unions. E.g.:

intersectionWithInterval : Interval -> Union -> Union

Return the intersection of an interval with a Union. E.g.:

subtract : Interval -> Interval -> Union

Subtract interval b from interval a, returning the parts of a that did not intersect with b.

E.g.:

subtractInterval : Interval -> Union -> Union

Subtract an interval from the given union, returning the contents of the union that did not intersect with the interval.

E.g.:

subtractUnions : Union -> Union -> Union

Subtract union b from union a, returning the contents of a that did not intersect with b.

E.g.:

lowerBound : Union -> Maybe Bound

Return the lower bound of a union, if it's not empty.

upperBound : Union -> Maybe Bound

Return the upper bound of a union, if it's not empty.

Conversion

toIntervals : Union -> List Interval

Returns list of intervals

unionToString : Union -> String

Return the string representation of the given Union.