Build, Augment and Destroy, Universally

  • Neil Ghani
  • Tarmo Uustalu
  • Varmo Vene
Part of the Lecture Notes in Computer Science book series (LNCS, volume 3302)


We give a semantic footing to the fold/build syntax of programming with inductive types, covering shortcut deforestation, based on a universal property. Specifically, we give a semantics for inductive types based on limits of algebra structure forgetting functors and show that it is equivalent to the usual initial algebra semantics. We also give a similar semantic account of the augment generalization of build and of the unfold/destroy syntax of coinductive types.


Coherence Assure Barb Meijer PPDP 


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Altenkirch, T.: Logical relations and inductive/coinductive types. In: Gottlob, G., Grandjean, E., Seyr, K. (eds.) CSL 1998. LNCS, vol. 1584, pp. 343–354. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  2. 2.
    Bainbridge, E.S., Freyd, P.J., Scedrov, A., Scott, P.J.: Functorial polymorphism. Theoretical Computer Science 70(1), 35–64 (1991); Corrigendum, ibid. 71(3), 431 (1991) MathSciNetCrossRefMATHGoogle Scholar
  3. 3.
    Böhm, C., Berarducci, A.: Automatic synthesis of typed Λ-programs on term algebras. Theoretical Computer Science 39(2–3), 135–154 (1985)MathSciNetCrossRefMATHGoogle Scholar
  4. 4.
    Dubuc, E., Street, R.: Dinatural transformations. In: Lane, S.M. (ed.) Reports of the Midwest Category Seminar IV, pp. 126–137. Springer, Heidelberg (1970)CrossRefGoogle Scholar
  5. 5.
    Eppendahl, A.: Parametricity and Mulry’s strong dinaturality. Technical Report 768, Dept.of Computer Science, Queen Mary and Westfield College, London (1999)Google Scholar
  6. 6.
    Eppendahl, A.: Categories and Types for Axiomatic Domain Theory. PhD thesis, Queen Mary, University of London (2003)Google Scholar
  7. 7.
    Fegaras, L.: Using the parametricity proposition for program fusion. Technical report CSE-96-001, Dept.of Computer Science and Engineering, Oregon Graduate Institute, Portland, OR (1996)Google Scholar
  8. 8.
    Freyd, P.J.: Structural polymorphism. Theoretical Computer Science 115(1), 107–129 (1993)MathSciNetCrossRefMATHGoogle Scholar
  9. 9.
    Ghani, N., Lüth, C., Marchi, F.D.: Coalgebraic monads. In: Moss, L.S. (ed.) Proc. of 5th Wksh. on Coalgebraic Methods in Computer Science, CMCS 2002. Electronic Notes in Theoretical Computer Science, vol. 65(1). Elsevier, Amsterdam (2002)Google Scholar
  10. 10.
    Gill, A., Launchbury, J., Jones, S.L.P.: A short cut to deforestation. In: Conf. Record of 6th ACM SIGPLAN-SIGARCH Int. Conf. on Functional Programming Languages and Computer Architecture, FPCA 1993, pp. 223–232. ACM Press, New York (1993)Google Scholar
  11. 11.
    Gill, A.J.: Cheap Deforestation for Non-strict Functional Languages. PhD thesis, Univ. of Glasgow (1996)Google Scholar
  12. 12.
    Girard, J.-Y., Scedrov, A., Scott, P.J.: Normal forms and cut-free proofs as natural transformations. In: Moschovakis, Y.N. (ed.) Logic from Computer Science, Mathematical Sciences Research Institute Publications, vol. 21, pp. 217–241. Springer, Heidelberg (1991)Google Scholar
  13. 13.
    Hagino, T.: A typed lambda calculus with categorical type constructors. In: Pitt, D.H., Rydeheard, D.E., Poigné, A. (eds.) Category Theory and Computer Science. LNCS, vol. 283, pp. 140–157. Springer, Heidelberg (1987)CrossRefGoogle Scholar
  14. 14.
    Hasegawa, R.: Categorical data types in parametric polymorphism. Mathematical Structures in Computer Science 4(1), 71–109 (1994)MathSciNetCrossRefMATHGoogle Scholar
  15. 15.
    Johann, P.: A generalization of short-cut fusion and its correctness proof. Higher-Order and Symbolic Computation 15(4), 273–300 (2002)CrossRefMATHGoogle Scholar
  16. 16.
    Johann, P.: Short-cut fusion is correct. Journal of Functional Programming 13(4), 797–814 (2003)MathSciNetCrossRefMATHGoogle Scholar
  17. 17.
    Krstić, S., Launchbury, J., Pavlović, D.: Categories of processes enriched in final coalgebras. In: Honsell, F., Miculan, M. (eds.) ETAPS 2001 and FOSSACS 2001. LNCS, vol. 2030, pp. 303–317. Springer, Heidelberg (2001)CrossRefGoogle Scholar
  18. 18.
    Launchbury, J., Sheard, T.: Warm fusion: Deriving build-catas from recursive definitions. In: Conf. Record 7th ACM SIGPLAN-SIGARCH Int. Conf. on Functional Programming Languages and Computer Architecture, FPCA 1995, pp. 314–323. ACM Press, New York (1995)Google Scholar
  19. 19.
    Leivant, D.: Reasoning about functional programs and complexity classes associated with type disciplines. In: Proc. of 24th Annual IEEE Symp. on Foundations of Computer Science, FOCS 1983, pp. 460–469. IEEE CS Press, Los Alamitos (1983)Google Scholar
  20. 20.
    Mac Lane, S.: Categories for the Working Mathematician, 2nd edn. Graduate Texts in Mathematics, vol. 5. Springer, Heidelberg (1971); (1st edn., 1971)CrossRefMATHGoogle Scholar
  21. 21.
    Malcolm, G.: Data structures and program transformation. Science of Computer Programming 14(2–3), 255–279 (1990)MathSciNetCrossRefMATHGoogle Scholar
  22. 22.
    Meijer, E., Fokkinga, M., Paterson, R.: Functional programming with bananas, lenses, envelopes and barbed wire. In: Hughes, J. (ed.) FPCA 1991. LNCS, vol. 523, pp. 124–144. Springer, Heidelberg (1991)CrossRefGoogle Scholar
  23. 23.
    Mulry, P.S.: Strong monads, algebras and fixed points. In: Fourman, M.P., Johnstone, P.T., Pitts, A.M. (eds.) Applications of Categories in Computer Science. London Math. Society Lecture Note Series, vol. 177, pp. 202–216. Cambridge University Press, Cambridge (1992)CrossRefGoogle Scholar
  24. 24.
    Paré, R., Román, L.: Dinatural numbers. Journal of Pure and Applied Algebra 128(1), 33–92 (1998)MathSciNetCrossRefMATHGoogle Scholar
  25. 25.
    Pavlovic, D.: Logic of build fusion. Technical Report KES.U.00.9, Kestrel Institute (2000)Google Scholar
  26. 26.
    Reynolds, J.C.: Towards a theory of type structure. In: Robinet, B. (ed.) Proc. of Programming Symp. (Colloque sur la programmation). LNCS, vol. 19, pp. 408–425. Springer, Heidelberg (1974)Google Scholar
  27. 27.
    Reynolds, J.C.: Types, abstraction and parametric polymorphism. In: Mason, R.E.A. (ed.) Proc. of 9th IFIP World Computer Congress, Information Processing 1983, pp. 513–523. North-Holland, Amsterdam (1983)Google Scholar
  28. 28.
    Sheard, T., Fegaras, L.: A fold for all seasons. In: Proc. of 6th ACM SIGPLAN/SIGARCH Int. Conf. on Functional Programming Languages and Computer Architecture, FPCA 1993, pp. 233–242. ACM Press, New York (1993)Google Scholar
  29. 29.
    Svenningsson, J.: Shortcut fusion for accumulating parameters & zip-like functions. In: Proc. of 7th ACM SIGPLAN Int. Conf. on Functional Programming, ICFP 2002, SIGPLAN Notices, vol. 37(9), pp. 124–132. ACM Press, New York (2002)Google Scholar
  30. 30.
    Takano, A., Meijer, E.: Shortcut deforestation in calculational form. In: Conf. Record 7th ACM SIGPLAN/SIGARCH Int. Conf. on Functional Programming Languages and Computer Architecture, FPCA 1995, pp. 306–313. ACM Press, New York (1995)Google Scholar
  31. 31.
    Turbak, F., Wells, J.B.: Cycle therapy: A prescription for fold and unfold on regular trees. In: Proc. of 3rd Int. ACM SIGPLAN Conf. on Principles and Practice of Declarative Programming, PPDP 2001, pp. 137–149. ACM Press, New York (2001)Google Scholar
  32. 32.
    Uustalu, T.: Generalizing substitution. Theoretical Informatics and Applications 37(4), 315–336 (2003)MathSciNetCrossRefMATHGoogle Scholar
  33. 33.
    Voigtländer, J.: Concatenate, reverse and map vanish for free. In: Proc. of 7th ACM SIGPLAN Int. Conf. on Functional Programming, ICFP 2002, SIGPLAN Notices, vol. 37(9), pp. 14–25. ACM Press, New York (2002)Google Scholar
  34. 34.
    Wadler, P.: Theorems for free? In: Proc. of 4th Int. Conf. on Funct. Prog. Languages and Computer Arch. FPCA 1989, pp. 347–359. ACM Press, New York (1989)Google Scholar
  35. 35.
    Wadler, P.: Deforestation: Transforming programs to eliminate trees. Theoretical Computer Science 73(2), 231–248 (1990)MathSciNetCrossRefMATHGoogle Scholar
  36. 36.
    Wadler, P.: Recursive types for free! Draft manuscript (1990)Google Scholar

Copyright information

© Springer-Verlag Berlin Heidelberg 2004

Authors and Affiliations

  • Neil Ghani
    • 1
  • Tarmo Uustalu
    • 2
  • Varmo Vene
    • 3
  1. 1.Dept. of Math. and Comp. Sci.University of LeicesterLeicesterUK
  2. 2.Institute of CyberneticsTallinn Univ. of TechnologyTallinnEstonia
  3. 3.Dept. of Computer ScienceUniversity of TartuTartuEstonia

Personalised recommendations