skip to main content
research-article

Monoids: theme and variations (functional pearl)

Published:13 September 2012Publication History
Skip Abstract Section

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. M. Cole. Parallel programming with list homomorphisms. Parallel Processing Letters, 5: 191--203, 1995.Google ScholarGoogle ScholarCross RefCross Ref
  3. C. Elliott. Functional Images. In The Fun of Programming, "Cornerstones of Computing" series. Palgrave, Mar. 2003. URL http://conal.net/papers/functional-images/.Google ScholarGoogle Scholar
  4. 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 ScholarGoogle Scholar
  5. R. Hinze and R. Paterson. Finger trees: a simple general-purpose data structure. J. Funct. Program., 16 (2): 197--217, Mar. 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. D. Michie. "Memo" Functions and Machine Learning. Nature, 218: 306, Apr. 1968.Google ScholarGoogle Scholar
  9. D. Piponi. Fast incremental regular expression matching with monoids, January 2009. URL http://blog.sigfpe.com/2009/01/fast-incremental-regular-expression.html.Google ScholarGoogle Scholar
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Monoids: theme and variations (functional pearl)

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 47, Issue 12
          Haskell '12
          December 2012
          157 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/2430532
          Issue’s Table of Contents
          • cover image ACM Conferences
            Haskell '12: Proceedings of the 2012 Haskell Symposium
            September 2012
            168 pages
            ISBN:9781450315746
            DOI:10.1145/2364506

          Copyright © 2012 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 13 September 2012

          Check for updates

          Qualifiers

          • research-article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!