MODULE Alt
type class
interface Alt<F> extends Functor<F> {
alt: <A>(fx: HKT<F, A>, fy: HKT<F, A>) => HKT<F, A>
}
The Alt
type class identifies an associative operation on a type constructor. It is similar to Semigroup
, except
that it applies to types of kind * -> *
, like Array
or Option
, rather than concrete types like string
or
number
.
Alt
instances are required to satisfy the following laws:
- Associativity:
A.alt(A.alt(fa, ga), ha) = A.alt(fa, A.alt(ga, ha))
- Distributivity:
A.map(A.alt(fa, ga), ab) = A.alt(A.map(fa, ab), A.map(ga, ab))