Overview
The Plus
type class extends the alt
type class with a value that should be the left and right identity for alt
.
It is similar to Monoid
, except that it applies to types of kind * -> *
, like Array
or Option
, rather than
concrete types like string
or number
.
Plus
instances should satisfy the following laws:
- Left identity:
A.alt(zero, fa) == fa
- Right identity:
A.alt(fa, zero) == fa
- Annihilation:
A.map(zero, fa) == zero
Table of contents
- Plus (interface)
- Plus1 (interface)
- Plus2 (interface)
- Plus2C (interface)
- Plus3 (interface)
- Plus3C (interface)
Plus (interface)
Signature
export interface Plus<F> extends Alt<F> {
readonly zero: <A>() => HKT<F, A>
}
Added in v1.0.0
Plus1 (interface)
Signature
export interface Plus1<F extends URIS> extends Alt1<F> {
readonly zero: <A>() => Type<F, A>
}
Plus2 (interface)
Signature
export interface Plus2<F extends URIS2> extends Alt2<F> {
readonly zero: <L, A>() => Type2<F, L, A>
}
Plus2C (interface)
Signature
export interface Plus2C<F extends URIS2, L> extends Alt2C<F, L> {
readonly zero: <A>() => Type2<F, L, A>
}
Plus3 (interface)
Signature
export interface Plus3<F extends URIS3> extends Alt3<F> {
readonly zero: <U, L, A>() => Type3<F, U, L, A>
}
Plus3C (interface)
Signature
export interface Plus3C<F extends URIS3, U, L> extends Alt3C<F, U, L> {
readonly zero: <A>() => Type3<F, U, L, A>
}