Abstract
The monoid is a humble algebraic structure, at first glance even downright boring. However, there's much more to monoids than meets the eye. Using examples taken from the diagrams vector graphics framework as a case study, I demonstrate the power and beauty of monoids for library design. The paper begins with an extremely simple model of diagrams and proceeds through a series of incremental variations, all related somehow to the central theme of monoids. Along the way, I illustrate the power of compositional semantics; why you should also pay attention to the monoid's even humbler cousin, the semigroup; monoid homomorphisms; and monoid actions.
- R. S. Bird. An introduction to the theory of lists. In Proceedings of the NATO Advanced Study Institute on Logic of programming and calculi of discrete design, pages 5--42, New York, NY, USA, 1987. Springer-Verlag New York, Inc. Google Scholar
Digital Library
- M. Cole. Parallel programming with list homomorphisms. Parallel Processing Letters, 5: 191--203, 1995.Google Scholar
Cross Ref
- C. Elliott. Functional Images. In The Fun of Programming, "Cornerstones of Computing" series. Palgrave, Mar. 2003. URL http://conal.net/papers/functional-images/.Google Scholar
- C. Elliott. Denotational design with type class morphisms (extended version). Technical Report 2009-01, LambdaPix, March 2009. URL http://conal.net/papers/type-class-morphisms.Google Scholar
- R. Hinze and R. Paterson. Finger trees: a simple general-purpose data structure. J. Funct. Program., 16 (2): 197--217, Mar. 2006. Google Scholar
Digital Library
- R. J. M. Hughes. A novel representation of lists and its application to the function "reverse". Information Processing Letters, 22 (3): 141--144, 1986. Google Scholar
Digital Library
- K. Matlage and A. Gill. ChalkBoard: Mapping Functions to Polygons. In M. Morazán and S.-B. Scholz, editors, Implementation and Application of Functional Languages, volume 6041 of Lecture Notes in Computer Science, pages 55--71. Springer Berlin / Heidelberg, 2011. Google Scholar
Digital Library
- D. Michie. "Memo" Functions and Machine Learning. Nature, 218: 306, Apr. 1968.Google Scholar
- D. Piponi. Fast incremental regular expression matching with monoids, January 2009. URL http://blog.sigfpe.com/2009/01/fast-incremental-regular-expression.html.Google Scholar
- D. Turner. Miranda: A non-strict functional language with polymorphic types. In J.-P. Jouannaud, editor, Functional Programming Languages and Computer Architecture, volume 201 of Lecture Notes in Computer Science, pages 1--16. Springer Berlin / Heidelberg, 1985. Google Scholar
Digital Library
- P. Wadler. Theorems for free! In Proceedings of the fourth international conference on Functional programming languages and computer architecture, FPCA '89, pages 347--359, New York, NY, USA, 1989. ACM. Google Scholar
Digital Library
Index Terms
Monoids: theme and variations (functional pearl)
Recommendations
Monoids: theme and variations (functional pearl)
Haskell '12: Proceedings of the 2012 Haskell SymposiumThe monoid is a humble algebraic structure, at first glance even downright boring. However, there's much more to monoids than meets the eye. Using examples taken from the diagrams vector graphics framework as a case study, I demonstrate the power and ...
Arrows, like Monads, are Monoids
Monads are by now well-established as programming construct in functional languages. Recently, the notion of ''Arrow'' was introduced by Hughes as an extension, not with one, but with two type parameters. At first, these Arrows may look somewhat ...
Combinatorial operads from monoids
We introduce a functorial construction which, from a monoid, produces a set-operad. We obtain new (symmetric or not) operads as suboperads or quotients of the operads obtained from usual monoids such as the additive and multiplicative monoids of ...







Comments