# Ord

```
interface Ord<A> extends Setoid<A> {
readonly compare: (x: A, y: A) => Ordering
}
```

Added in v1.0.0 (type class)

The `Ord`

type class represents types which support comparisons with a *total order*.

Instances should satisfy the laws of total orderings:

- Reflexivity:
`S.compare(a, a) <= 0`

- Antisymmetry: if
`S.compare(a, b) <= 0`

and`S.compare(b, a) <= 0`

then`a <-> b`

- Transitivity: if
`S.compare(a, b) <= 0`

and`S.compare(b, c) <= 0`

then`S.compare(a, c) <= 0`

## ordBoolean

```
Ord<boolean>
```

Added in v1.0.0 (instance)

## ordDate

```
Ord<Date>
```

Added in v1.4.0 (instance)

## ordNumber

```
Ord<number>
```

Added in v1.0.0 (instance)

## ordString

```
Ord<string>
```

Added in v1.0.0 (instance)

## between

```
<A>(O: Ord<A>): ((low: A, hi: A) => (x: A) => boolean)
```

Added in v1.0.0 (function)

Test whether a value is between a minimum and a maximum (inclusive)

## clamp

```
<A>(O: Ord<A>): ((low: A, hi: A) => (x: A) => A)
```

Added in v1.0.0 (function)

Clamp a value between a minimum and a maximum

## contramap

```
<A, B>(f: (b: B) => A, fa: Ord<A>): Ord<B>
```

Added in v1.0.0 (function)

## fromCompare

```
<A>(compare: (x: A, y: A) => Ordering): Ord<A>
```

Added in v1.0.0 (function)

## getDualOrd

```
<A>(O: Ord<A>): Ord<A>
```

Added in v1.3.0 (function)

## getProductOrd

```
<A, B>(OA: Ord<A>, OB: Ord<B>): Ord<[A, B]>
```

Added in v1.0.0 (function)

## getSemigroup

```
<A = never>(): Semigroup<Ord<A>>
```

Added in v1.0.0 (function)

## greaterThan

```
<A>(O: Ord<A>) => (x: A, y: A): boolean
```

Added in v1.0.0 (function)

Test whether one value is *strictly greater than* another

## greaterThanOrEq

```
<A>(O: Ord<A>) => (x: A, y: A): boolean
```

Added in v1.0.0 (function)

Test whether one value is *non-strictly greater than* another

## lessThan

```
<A>(O: Ord<A>) => (x: A, y: A): boolean
```

Added in v1.0.0 (function)

Test whether one value is *strictly less than* another

## lessThanOrEq

```
<A>(O: Ord<A>) => (x: A, y: A): boolean
```

Added in v1.0.0 (function)

Test whether one value is *non-strictly less than* another

## max

```
<A>(O: Ord<A>) => (x: A, y: A): A
```

Added in v1.0.0 (function)

Take the maximum of two values. If they are considered equal, the first argument is chosen

## min

```
<A>(O: Ord<A>) => (x: A, y: A): A
```

Added in v1.0.0 (function)

Take the minimum of two values. If they are considered equal, the first argument is chosen

## unsafeCompare

```
(x: any, y: any): Ordering
```

Added in v1.0.0 (function)