Compiling to categories
Author:
Open Access
- 29 August 2017
- journal article
- Published by Association for Computing Machinery (ACM) in Proceedings of the ACM on Programming Languages
- Vol. 1 (ICFP) , 1-27
Abstract
It is well-known that the simply typed lambda-calculus is modeled by any cartesian closed category (CCC). This correspondence suggests giving typed functional programs a variety of interpretations, each corresponding to a different category. A convenient way to realize this idea is as a collection of meaning-preserving transformations added to an existing compiler, such as GHC for Haskell. This paper describes such an implementation and demonstrates its use for a variety of interpretations including hardware circuits, automatic differentiation, incremental computation, and interval analysis. Each such interpretation is a category easily defined in Haskell (outside of the compiler). The general technique appears to provide a compelling alternative to deeply embedded domain-specific languages.Keywords
This publication has 36 references indexed in Scilit:
- Z3: An Efficient SMT Solver2008
- Category Theory2006
- Associated type synonyms2005
- Programming graphics processors functionally2004
- Monads for incremental computing2002
- Lava1998
- Fixed points in cartesian closed categoriesTheoretical Computer Science, 1990
- The categorical abstract machineScience of Computer Programming, 1987
- Categorical combinatorsInformation and Control, 1986
- Can programming be liberated from the von Neumann style?Communications of the ACM, 1978