Initial Algebra Semantics Is Enough!

  • Patricia Johann
  • Neil Ghani
Part of the Lecture Notes in Computer Science book series (LNCS, volume 4583)


Initial algebra semantics is a cornerstone of the theory of modern functional programming languages. For each inductive data type, it provides a fold combinator encapsulating structured recursion over data of that type, a Church encoding, a build combinator which constructs data of that type, and a fold/build rule which optimises modular programs by eliminating intermediate data of that type. It has long been thought that initial algebra semantics is not expressive enough to provide a similar foundation for programming with nested types. Specifically, the folds have been considered too weak to capture commonly occurring patterns of recursion, and no Church encodings, build combinators, or fold/build rules have been given for nested types. This paper overturns this conventional wisdom by solving all of these problems.


Natural Transformation Fusion Rule Forgetful Functor Inductive Type Structure Recursion 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Abel, A., Matthes, R., Uustalu, T.: Iteration schemes for higher-order and nested datatypes. Theoretical Computer Science 333(1-2), 3–66 (2005)zbMATHCrossRefGoogle Scholar
  2. 2.
    Altenkirch, T., Reus, B.: Monadic presentations of lambda terms using generalized inductive types. In: Flum, J., Rodríguez-Artalejo, M. (eds.) CSL 1999. LNCS, vol. 1683, pp. 453–468. Springer, Heidelberg (1999)Google Scholar
  3. 3.
    Bayley, I.: Generic Operations on Nested Datatypes. Ph.D. Dissertation, University of Oxford (2001)Google Scholar
  4. 4.
    Bird, R., Meertens, L.: Nested datatypes. In: Jeuring, J. (ed.) MPC 1998. LNCS, vol. 1422, pp. 52–67. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  5. 5.
    Bird, R., Paterson, R.: de Bruijn notation as a nested datatype. Journal of Functional Programming 9(1), 77–91 (1998)CrossRefGoogle Scholar
  6. 6.
    Bird, R., Paterson, R.: Generalised folds for nested datatypes. Formal Aspects of Computing 11(2), 200–222 (1999)zbMATHCrossRefGoogle Scholar
  7. 7.
    Blampied, P.: Structured Recursion for Non-uniform Data-types. Ph.D. Dissertation, University of Nottingham (2000)Google Scholar
  8. 8.
    Fiore, M., Plotkin, G.D., Turi, D.: Abstract syntax and variable binding. In: Proc. Logic in Computer Science, pp. 193–202 (1999)Google Scholar
  9. 9.
    Gill, A.: Cheap Deforestation for Non-strict Functional Languages. Ph.D. Dissertation, Glasgow University (1996)Google Scholar
  10. 10.
    Gill, A., Launchbury, J., Peyton Jones, S.L.: A short cut to deforestation. In: Proc. Functional Programming Languages and Computer Architecture, pp. 223–232 (1993)Google Scholar
  11. 11.
    Ghani, N., Haman, M., Uustalu, T., Vene, V.: Representing cyclic structures as nested types. Presented at Trends in Functional Programming (2006)Google Scholar
  12. 12.
    Ghani, N., Johann, P., Uustalu, T., Vene, V.: Monadic augment and generalised short cut fusion. In: Proc. International Conference on Functional Programming, pp. 294–305 (2005)Google Scholar
  13. 13.
    Ghani, N., Uustalu, T., Vene, V.: Build, augment and destroy. Universally. In: Proc. Asian Symposium on Programming Languages, pp. 327–347 (2003)Google Scholar
  14. 14.
    Hinze, R.: Polytypic functions over nested datatypes. Discrete Mathematics and Theoretical Computer Science 3(4), 193–214 (1999)zbMATHGoogle Scholar
  15. 15.
    Hinze, R.: Efficient generalized folds. In: Jazayeri, M., Musser, D.R., Loos, R.G.K. (eds.) Generic Programming. LNCS, vol. 1766, Springer, Heidelberg (2000)Google Scholar
  16. 16.
    Hinze, R.: Functional Pearl: Perfect trees and bit-reversal permutations. Journal of Functional Programming 10(3), 305–317 (2000)zbMATHCrossRefGoogle Scholar
  17. 17.
    Hinze, R.: Manufacturing datatypes. Journal of Functional Programming 11(5), 493–524 (2001)zbMATHCrossRefGoogle Scholar
  18. 18.
    Johann, P.: A generalization of short-cut fusion and its correctness proof. Higher-order and Symbolic Computation 15, 273–300 (2002)zbMATHCrossRefGoogle Scholar
  19. 19.
    MacLane, S.: Categories for the Working Mathematician. Springer, Heidelberg (1971)Google Scholar
  20. 20.
    Martin, C., Gibbons, J., Bayley, I.: Disciplined efficient generalised folds for nested datatypes. Formal Aspects of Computing 16(1), 19–35 (2004)zbMATHCrossRefGoogle Scholar
  21. 21.
    McBride, C., McKinna, J.: View from the left. Journal of Functional Programming 14(1), 69–111 (2004)zbMATHCrossRefGoogle Scholar
  22. 22.
    Pitts, A.: Parametric polymorphism and operational equivalence. Mathematical Structures in Computer Science 10, 1–39 (2000)CrossRefGoogle Scholar
  23. 23.
    Takano, A., Meijer, E.: Shortcut deforestation in calculational form. In: Proc. Functional Programming Languages and Computer Architecture, pp. 306–313 (1995)Google Scholar

Copyright information

© Springer Berlin Heidelberg 2007

Authors and Affiliations

  • Patricia Johann
    • 1
  • Neil Ghani
    • 2
  1. 1.Rutgers University, Camden, NJUSA
  2. 2.University of Nottingham, NottinghamUK

Personalised recommendations