skip to main content
research-article

Species and functors and types, oh my!

Published:30 September 2010Publication History
Skip Abstract Section

Abstract

The theory of combinatorial species, although invented as a purely mathematical formalism to unify much of combinatorics, can also serve as a powerful and expressive language for talking about data types. With potential applications to automatic test generation, generic programming, and language design, the theory deserves to be much better known in the functional programming community. This paper aims to teach the basic theory of combinatorial species using motivation and examples from the world of functional programming. It also introduces the species library, available on Hackage, which is used to illustrate the concepts introduced and can serve as a platform for continued study and research.

Skip Supplemental Material Section

Supplemental Material

haskell-1700-yorgey.mov

References

  1. }}Michael Abbott, Thorsten Altenkirch, and Neil Ghani. Categories of Containers. In Foundations of Software Science and Computation Structures, pages 23--38. 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. }}Michael Abbott, Thorsten Altenkirch, Neil Ghani, and Conor McBride. Derivatives of Containers. In Typed Lambda Calculi and Applications, TLCA, volume 2701 of LNCS. Springer-Verlag, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. }}Michael Abbott, Thorsten Altenkirch, Neil Ghani, and Conor McBride. Constructing Polymorphic Programs with Quotient Types. In 7th International Conference on Mathematics of Program Construction (MPC 2004), volume 3125 of LNCS. Springer-Verlag, 2004.Google ScholarGoogle Scholar
  4. }}F. Bergeron, G. Labelle, and P. Leroux. Combinatorial species and tree-like structures. Number 67 in Encyclopedia of Mathematics and its Applications. Cambridge University Press, Cambridge, 1998.Google ScholarGoogle Scholar
  5. }}Jean-Philippe Bernardy, Patrik Jansson, and Koen Claessen. Testing polymorphic properties. In ESOP 2010: Proceedings of the 19th European Symposium on Programming, pages 125--144, London, UK, 2010. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. }}Bird and Meertens. Nested datatypes. In MPC: 4th International Conference on Mathematics of Program Construction. LNCS, Springer-Verlag, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. }}Benjamin Canou and Alexis Darrasse. Fast and sound random generation for automated testing and benchmarking in objective Caml. In ML '09: Proceedings of the 2009 ACM SIGPLAN workshop on ML, pages 61--70, New York, NY, USA, 2009. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. }}Jacques Carette and Gordon Uszkay. Species: making analytic functors practical for functional programming. Available at http://www.cas.mcmaster.ca/~carette/species/, 2008.Google ScholarGoogle Scholar
  9. }}Koen Claessen and John Hughes. QuickCheck: a lightweight tool for random testing of Haskell programs. In ICFP '00: Proceedings of the fifth ACM SIGPLAN international conference on Functional programming, pages 268--279, New York, NY, USA, 2000. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. }}Duncan Coutts, Isaac Potoczny-Jones, and Don Stewart. Haskell: batteries included. In Haskell '08: Proceedings of the first ACM SIGPLAN symposium on Haskell, pages 125--126, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. }}Jonas Almström Duregård. AGATA: Random generation of test data. Master's thesis, Chalmers University of Technology, December 2009.Google ScholarGoogle Scholar
  12. }}P. Flajolet, B. Salvy, and P. Zimmermann. Lambda-upsilon-omega: The 1989 cookbook. Technical Report 1073, Institut National de Recherche en Informatique et en Automatique, August 1989. 116 pages.Google ScholarGoogle Scholar
  13. }}Philippe Flajolet and Bruno Salvy. Computer algebra libraries for combinatorial structures. Journal of Symbolic Computation, 20(5-6):653--671, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. }}Gérard Huet. Functional pearl: The zipper. J. Functional Programming, 7:7--5, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. }}C. Barry Jay and J. Robin B. Cockett. Shapely types and shape polymorphism. In ESOP '94: Proceedings of the 5th European Symposium on Programming, pages 302--316, London, UK, 1994. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. }}André Joyal. Une théorie combinatoire des Séries formelles. Advances in Mathematics, 42(1):1--82, 1981.Google ScholarGoogle ScholarCross RefCross Ref
  17. }}Conor McBride. The Derivative of a Regular Type is its Type of One-Hole Contexts. Available at http://www.cs.nott.ac.uk/~ctm/diff.ps.gz, 2001.Google ScholarGoogle Scholar
  18. }}Conor McBride. Clowns to the left of me, jokers to the right (pearl): dissecting data structures. In Proceedings of the 35th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages, pages 287--295, San Francisco, California, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. }}M. Douglas McIlroy. Power series, power serious. Journal of Functional Programming, 9(03):325--337, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. }}Peter Morris, Thorsten Altenkirch, and Conor Mcbride. Exploring the regular tree types. 2004.Google ScholarGoogle Scholar
  21. }}Dan Piponi. A small combinatorial library, November 2007. http://blog.sigfpe.com/2007/11/small-combinatorial-library.html.Google ScholarGoogle Scholar
  22. }}Colin Runciman, Matthew Naylor, and Fredrik Lindblad. Smallcheck and lazy smallcheck: automatic exhaustive testing for small values. In Haskell '08: Proceedings of the first ACM SIGPLAN symposium on Haskell, pages 37--48, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. }}Herbert S. Wilf. Generatingfunctionology. Academic Press, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Species and functors and types, oh my!

        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 45, Issue 11
          HASKELL '10
          November 2010
          156 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/2088456
          Issue’s Table of Contents
          • cover image ACM Conferences
            Haskell '10: Proceedings of the third ACM Haskell symposium on Haskell
            September 2010
            166 pages
            ISBN:9781450302524
            DOI:10.1145/1863523

          Copyright © 2010 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 30 September 2010

          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!