Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Bounded overview

The Bounded type class represents totally ordered types that have an upper and lower boundary.

Instances should satisfy the following law in addition to the Ord laws:

  • Bounded: bottom <= a <= top

Added in v2.0.0


Table of contents


model

Bounded (interface)

Signature

export interface Bounded<A> extends Ord<A> {
  readonly top: A
  readonly bottom: A
}

Added in v2.0.0

utils

clamp

Clamp a value between bottom and top values.

Signature

export declare const clamp: <A>(B: Bounded<A>) => (a: A) => A

Added in v2.12.0

reverse

Reverses the Ord of a bound and swaps top and bottom values.

Signature

export declare const reverse: <A>(B: Bounded<A>) => Bounded<A>

Added in v2.12.0

zone of death

boundedNumber

Use Bounded instead.

Signature

export declare const boundedNumber: Bounded<number>

Added in v2.0.0