It is well-known that monads are monoids in the category of endo-functors, and in fact so are applicative functors. Unfortunately, the benefits of this unified view are lost when the additional non-determinism structure of |MonadPlus| or |Alternative| is required. This article recovers the essence of these two type classes by extending monoids to near-semirings with both additive and multiplicative structure. This unified algebraic view enables us to generically define the free construction as well as a novel double Cayley representation that optimises both left-nested sums and left-nested products.
@inproceedings{ppdp2015,
title = {From monoids to near-semirings: the essence of MonadPlus and Alternative},
author = {Exequiel Rivas and Mauro Jaskelioff and Tom Schrijvers},
year = {2015},
booktitle = {PPDP 2015},
url = {/Research/papers/ppdp2015.pdf},
talk = {/Research/talks/ppdp2015.pdf},
abstract = {It is well-known that monads are monoids in the category of
endo-functors, and in fact so are applicative
functors. Unfortunately, the benefits of this unified view are lost
when the additional non-determinism structure of |MonadPlus| or
|Alternative| is required.
This article recovers the essence of these two type classes by
extending monoids to near-semirings with both additive and
multiplicative structure. This unified algebraic view enables us to
generically define the free construction as well as a novel double
Cayley representation that optimises both left-nested sums and
left-nested products.
},
}