MODULE Alternative
type class
interface Alternative<F> extends Applicative<F>, Plus<F> {}
The Alternative
type class has no members of its own; it just specifies that the type constructor has both
Applicative
and Plus
instances.
Types which have Alternative
instances should also satisfy the following laws:
- Distributivity:
A.ap(A.alt(fab, gab), fa) = A.alt(A.ap(fab, fa), A.ap(gab, fa))
- Annihilation:
A.ap(zero, fa) = zero