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.
Supplemental Material
- }}Michael Abbott, Thorsten Altenkirch, and Neil Ghani. Categories of Containers. In Foundations of Software Science and Computation Structures, pages 23--38. 2003. Google Scholar
Digital Library
- }}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 Scholar
Digital Library
- }}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 Scholar
- }}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 Scholar
- }}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 Scholar
Digital Library
- }}Bird and Meertens. Nested datatypes. In MPC: 4th International Conference on Mathematics of Program Construction. LNCS, Springer-Verlag, 1998. Google Scholar
Digital Library
- }}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 Scholar
Digital Library
- }}Jacques Carette and Gordon Uszkay. Species: making analytic functors practical for functional programming. Available at http://www.cas.mcmaster.ca/~carette/species/, 2008.Google Scholar
- }}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 Scholar
Digital Library
- }}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 Scholar
Digital Library
- }}Jonas Almström Duregård. AGATA: Random generation of test data. Master's thesis, Chalmers University of Technology, December 2009.Google Scholar
- }}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 Scholar
- }}Philippe Flajolet and Bruno Salvy. Computer algebra libraries for combinatorial structures. Journal of Symbolic Computation, 20(5-6):653--671, 1995. Google Scholar
Digital Library
- }}Gérard Huet. Functional pearl: The zipper. J. Functional Programming, 7:7--5, 1997. Google Scholar
Digital Library
- }}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 Scholar
Digital Library
- }}André Joyal. Une théorie combinatoire des Séries formelles. Advances in Mathematics, 42(1):1--82, 1981.Google Scholar
Cross Ref
- }}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 Scholar
- }}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 Scholar
Digital Library
- }}M. Douglas McIlroy. Power series, power serious. Journal of Functional Programming, 9(03):325--337, 1999. Google Scholar
Digital Library
- }}Peter Morris, Thorsten Altenkirch, and Conor Mcbride. Exploring the regular tree types. 2004.Google Scholar
- }}Dan Piponi. A small combinatorial library, November 2007. http://blog.sigfpe.com/2007/11/small-combinatorial-library.html.Google Scholar
- }}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 Scholar
Digital Library
- }}Herbert S. Wilf. Generatingfunctionology. Academic Press, 1990. Google Scholar
Digital Library
Index Terms
Species and functors and types, oh my!
Recommendations
Species and functors and types, oh my!
Haskell '10: Proceedings of the third ACM Haskell symposium on HaskellThe 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 ...
Shared subtypes: subtyping recursive parametrized algebraic data types
Haskell '08: Proceedings of the first ACM SIGPLAN symposium on HaskellA newtype declaration in Haskell introduces a new type renaming an existing type. The two types are viewed by the programmer as semantically different, but share the same runtime representation. When operations on the two semantic views coincide, the ...







Comments