From monoids to near-semirings: the essence of MonadPlus and alternative

It is well-known that monads are monoids in the category of endofunctors, and in fact so are applicative functors. Unfortunately, the benefits of this unified view are lost when the additional nondeterminism 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.

[1]  Oleg Kiselyov,et al.  Reflection without remorse: revealing a hidden sequence to speed up monadic reflection , 2014, Haskell '14.

[2]  Ambrus Kaposi,et al.  Free Applicative Functors , 2014, MSFP.

[3]  S. Doaitse Swierstra,et al.  Parsing permutation phrases , 2004, J. Funct. Program..

[4]  Rick Statman Near Semi-rings and Lambda Calculus , 2014, RTA-TLCA.

[5]  K. V. Krishna,et al.  Representation of Near-Semirings and Approximation of Their Categories , 2008 .

[6]  Exequiel Rivas,et al.  Notions of computation as monoids* , 2014, Journal of Functional Programming.

[7]  J. Michael Spivey Algebras for combinatorial search , 2009, J. Funct. Program..

[8]  Conor McBride,et al.  Applicative programming with effects , 2008, J. Funct. Program..

[9]  John Hughes,et al.  A Novel Representation of Lists and its Application to the Function "reverse" , 1986, Inf. Process. Lett..

[10]  Bart Demoen,et al.  Heuristics Entwined with Handlers Combined: From Functional Specification to Logic Programming Implementation , 2014, PPDP '14.

[11]  Marco Grandis Cubical monads and their symmetries , 1993 .

[12]  Graham Hutton,et al.  Monadic parsing in Haskell , 1998, Journal of Functional Programming.

[13]  Exequiel Rivas,et al.  Functional pearl: a smart view on datatypes , 2015, ICFP.

[14]  Ralf Hinze,et al.  Deriving backtracking monad transformers , 2000, ICFP '00.

[15]  S. Doaitse Swierstra,et al.  Parse Your Options , 2013, The Beauty of Functional Code.

[16]  Nicolas Wu Heuristics entwined with handlers combined , 2014 .

[17]  Janis Voigtländer,et al.  Asymptotic Improvement of Computations over Free Monads , 2008, MPC.

[18]  Graham Hutton,et al.  Factorising folds for faster functions , 2010, J. Funct. Program..

[19]  Brian Day,et al.  Note on monoidal localisation , 1973, Bulletin of the Australian Mathematical Society.

[20]  Gordon D. Plotkin,et al.  Handlers of Algebraic Effects , 2009, ESOP.

[21]  Sebastian Fischer Reinventing Haskell Backtracking , 2009, GI Jahrestagung.