r-k-b / elm-interval / Bound

A representation of numeric bounds.

Types


type Bound
    = Inclusive Basics.Float
    | Exclusive Basics.Float

Represents an upper or lower, closed or open endpoint of an Interval. This encompasses the "endpoints" of unbounded intervals when the bound value is either of the Infinity values in the floating point spec.

Opaque type.

Operations on Bounds

minOuter : Bound -> Bound -> Bound

Return the outer minimum of two Bounds.

minOuter (Inclusive 1) (Exclusive 1) == Inclusive 1

minOuter (Inclusive 1) (Exclusive 0) == Exclusive 0

maxOuter : Bound -> Bound -> Bound

Return the outer maximum of two Bounds.

maxOuter (Inclusive 1) (Exclusive 1) == Inclusive 1

maxOuter (Inclusive 1) (Exclusive 2) == Exclusive 2

minInner : Bound -> Bound -> Bound

Return the inner minimum of two Bounds.

minInner (Inclusive 1) (Exclusive 1) == Exclusive 1

minInner (Inclusive 0) (Exclusive 1) == Inclusive 0

maxInner : Bound -> Bound -> Bound

Return the inner maximum of two Bounds.

maxInnerBound (Inclusive 1) (Exclusive 1) == Exclusive 1

maxInnerBound (Inclusive 0) (Exclusive 1) == Inclusive 0

invert : Bound -> Bound

Hold the bound value steady, but invert the open/closed property.

negate : Bound -> Bound

Hold the open/closed property, but invert the value.

Tests on Bounds

value : Bound -> Basics.Float

The value stored in the bound.

isOpen : Bound -> Basics.Bool

Whether the bound is open (exclusive) or closed (inclusive).

Synonym of isExclusive.

isInclusive : Bound -> Basics.Bool

Whether the bound is inclusive or exclusive.

isExclusive : Bound -> Basics.Bool

Whether the bound is exclusive or inclusive.