# Data.Operator.Top

- Package
- purescript-higher-order
- Repository
- matthew-hilty/purescript-higher-order

### #Top1 Source

`class Top1 (f :: Type -> Type) where`

The `Top1`

typeclass represents type constructors `f`

that have a
distinguished element `top1`

of type `forall a. f a`

as well as an
associated partial ordering (or at least a notion thereof), for which
`top1`

is the minimum or lowest bound.

Because the notion of maximality entails the notion of comparability,
the semantics of an instance of `Top1`

must be consistent with the
definitional requirements of a partial order. In fact, many instances of
`Top1`

are also instances of `PartialOrd1`

(and likely `Ord1`

as well).

In such cases, when a type operator `f`

is both a registered instance of
`Top1`

and one of `PartialOrd1`

, it must satisfy the following law:

- maximality:
`x .<=? top1 == Just true`

Likewise, if `f`

is an instance of `Top1`

and also an instance of
`Ord1`

, it must satisfy the following analogous law:

- maximality:
`x .<= top1`

Additionally, if `f`

is an instance of a higher-order additive
semigroup-like structure like `Alt`

, `f`

's `top1`

value must be one of the
structure's annihilating elements:

- Left annihilation:
`top1 + x .== top1`

- Right annihilation:
`x + top1 .== top1`

#### Members

`top1 :: forall a. f a`

### #Top1_ Source

`class Top1_ (f :: Type -> Type) where`

The `Top1_`

typeclass represents type constructors `f`

that have a
distinguished function `top1_`

of type `forall a. a -> f a`

as well as an
associated partial ordering (or at least a notion thereof), for which the
class of evaluations of `top1_`

constitutes the maximum or upper bound.

Because the notion of maximality entails the notion of comparability,
the semantics of an instance of `Top1_`

must be consistent with the
definitional requirements of a partial order. In fact, many instances of
`Top1_`

are also instances of `PartialOrd1`

(and likely `Ord1`

as well).

In such cases, when a type operator `f`

is both a registered instance of
`Top1_`

and one of `PartialOrd1`

, it must satisfy the following law:

- maximality:
`x .<=? top1_ y == Just true`

Likewise, if `f`

is an instance of `Top1_`

and also an instance of
`Ord1`

, it must satisfy the following analogous law:

- maximality:
`x .<= top1_ y`

Additionally, if `f`

is an instance of a higher-order additive
semigroup-like structure like `Alt`

, `f`

's `top1_`

value must be one of
the structure's annihilating elements:

- Left annihilation:
`top1_ x + y .== top1_ x`

- Right annihilation:
`x + top1_ y .== top1_ y`

#### Members

`top1_ :: forall a. a -> f a`

Commonly, instances of

`Applicative`

admit a coarse interpratation as a higher-order bounded meet-semilattice with one or two equivalence classes such that`pure`

serves as the`top1_`

upper bound. However, not all instances of`Applicative`

can/should be interpreted this way; and other less-coarse interpretations may also be possible. Here's a counter-example: