skip to main content
10.1145/1086365.1086372acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Recursive type generativity

Published: 12 September 2005 Publication History

Abstract

Existential types provide a simple and elegant foundation for understanding generative abstract data types, of the kind supported by the Standard ML module system. However, in attempting to extend ML with support for recursive modules, we have found that the traditional existential account of type generativity does not work well in the presence of mutually recursive module definitions. The key problem is that, in recursive modules, one may wish to define an abstract type in a context where a name for the type already exists, but the existential type mechanism does not allow one to do so.We propose a novel account of recursive type generativity that resolves this problem. The basic idea is to separate the act of generating a name for an abstract type from the act of defining its underlying representation. To define several abstract types recursively, one may first "forward-declare" them by generating their names, and then define each one secretly within its own defining expression. Intuitively, this can be viewed as a kind of backpatching semantics for recursion at the level of types. Care must be taken to ensure that a type name is not defined more than once, and that cycles do not arise among "transparent" type definitions.In contrast to the usual continuation-passing interpretation of existential types in terms of universal types, our account of type generativity suggests a destination-passing interpretation. Briefly, instead of viewing a value of existential type as something that creates a new abstract type every time it is unpacked, we view it as a function that takes as input a pre-existing undefined abstract type and defines it. By leaving the creation of the abstract type name up to the client of the existential, our approach makes it significantly easier to link abstract data types together recursively.

References

[1]
Roberto Amadio and Luca Cardelli. Subtyping recursive types. ACM Transactions on Programming Languages and Systems, 15(4):575--631, 1993.
[2]
Davide Ancona and Elena Zucca. A primitive calculus for module systems. In International Conference on Principles and Practice of Declarative Programming (PPDP), volume 1702 of Lecture Notes in Computer Science, pages 62--79. Springer-Verlag, 1999.
[3]
Karl Crary, Robert Harper, and Sidd Puri. What is a recursive module? In ACM Conference on Programming Language Design and Implementation (PLDI), pages 50--63, Atlanta, GA, 1999.
[4]
Derek Dreyer. A type system for well-founded recursion. In ACM Symposium on Principles of Programming Languages (POPL), pages 293--305, Venice, Italy, January 2004.
[5]
Derek Dreyer. Understanding and Evolving the ML Module System. PhD thesis, Carnegie Mellon University, Pittsburgh, PA, May 2005.
[6]
Derek Dreyer, Karl Crary, and Robert Harper. A type system for higher-order modules. In ACM Symposium on Principles of Programming Languages (POPL), New Orleans, LA, January 2003.
[7]
Dominic Duggan. Type-safe linking with recursive DLL's and shared libraries. ACM Transactions on Programming Languages and Systems, 24(6):711--804, November 2002.
[8]
Matthew Flatt and Matthias Felleisen. Units: Cool modules for HOT languages. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 236--248, Montreal, Canada, June 1998.
[9]
David K. Gifford and John M. Lucassen. Integrating functional and imperative programming. In ACM Conference on LISP and Functional Programming, Cambridge, MA, August 1986.
[10]
Mark P. Jones. Using parameterized signatures to express modular structure. In ACM Symposium on Principles of Programming Languages (POPL), pages 68--78, St. Petersburg Beach, FL, 1996.
[11]
Xavier Leroy. The Objective Caml system: Documentation and user's manual. http://www.ocaml.org/.
[12]
Xavier Leroy. Applicative functors and fully transparent higherorder modules. In ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), pages 142--153, San Francisco, CA, January 1995.
[13]
Xavier Leroy. A proposal for recursive modules in Objective Caml, May 2003. Available from the author's website.
[14]
Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997.
[15]
Moscow ML. www.dina.kvl.dk/~sestoft/mosml.html.
[16]
MzScheme. www.plt-scheme.org/software/mzscheme/.
[17]
Chris Okasaki. Purely Functional Data Structures. Cambridge University Press, 1998.
[18]
Andreas Rossberg. Generativity and dynamic opacity for abstract types. In International Conference on Principles and Practice of Declarative Programming (PPDP), Uppsala, Sweden, 2003.
[19]
Claudio V. Russo. Recursive structures for Standard ML. In International Conference on Functional Programming (ICFP), pages 50--61, Florence, Italy, September 2001.
[20]
Christopher A. Stone. Type definitions. In Benjamin C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 9. MIT Press, 2005.
[21]
Christopher A. Stone and Robert Harper. Extensional equivalence and singleton types. ACM Transactions on Computational Logic, 2005. To appear.
[22]
Jean-Pierre Talpin and Pierre Jouvelot. The type and effect discipline. Information and Computation, 111(2):245--296, 1994.
[23]
Joseph C. Vanderwaart, Derek Dreyer, Leaf Petersen, Karl Crary, Robert Harper, and Perry Cheng. Typed compilation of recursive datatypes. In ACM SIGPLAN Workshop on Types in Language Design and Implementation (TLDI), New Orleans, January 2003.
[24]
Philip Wadler. Listlessness is Better than Laziness. PhD thesis, Carnegie Mellon University, Pittsburgh, PA, August 1985.

Cited By

View all
  • (2018)Recursive type generativityJournal of Functional Programming10.1017/S095679680700642917:4-5(433-471)Online publication date: 24-Dec-2018
  • (2011)Generative type abstraction and type-level computationProceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages10.1145/1926385.1926411(227-240)Online publication date: 26-Jan-2011
  • (2011)Generative type abstraction and type-level computationACM SIGPLAN Notices10.1145/1925844.192641146:1(227-240)Online publication date: 26-Jan-2011
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP '05: Proceedings of the tenth ACM SIGPLAN international conference on Functional programming
September 2005
342 pages
ISBN:1595930647
DOI:10.1145/1086365
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 40, Issue 9
    Proceedings of the tenth ACM SIGPLAN international conference on Functional programming
    September 2005
    330 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/1090189
    Issue’s Table of Contents
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 12 September 2005

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. abstract data types
  2. effect systems
  3. generativity
  4. recursion
  5. recursive modules
  6. type systems

Qualifiers

  • Article

Conference

ICFP05
Sponsor:

Acceptance Rates

Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)2
  • Downloads (Last 6 weeks)0
Reflects downloads up to 17 Jan 2025

Other Metrics

Citations

Cited By

View all
  • (2018)Recursive type generativityJournal of Functional Programming10.1017/S095679680700642917:4-5(433-471)Online publication date: 24-Dec-2018
  • (2011)Generative type abstraction and type-level computationProceedings of the 38th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages10.1145/1926385.1926411(227-240)Online publication date: 26-Jan-2011
  • (2011)Generative type abstraction and type-level computationACM SIGPLAN Notices10.1145/1925844.192641146:1(227-240)Online publication date: 26-Jan-2011
  • (2009)A module system independent of base languagesProceedings of the 1st Workshop on Modules and Libraries for Proof Assistants10.1145/1735813.1735818(24-29)Online publication date: 3-Aug-2009
  • (2007)Principal type schemes for modular programsProceedings of the 16th European Symposium on Programming10.5555/1762174.1762215(441-457)Online publication date: 24-Mar-2007
  • (2007)A type system for recursive modulesACM SIGPLAN Notices10.1145/1291220.129119642:9(289-302)Online publication date: 1-Oct-2007
  • (2007)A type system for recursive modulesProceedings of the 12th ACM SIGPLAN international conference on Functional programming10.1145/1291151.1291196(289-302)Online publication date: 3-Oct-2007
  • (2006)From structures and functors to modules and unitsACM SIGPLAN Notices10.1145/1160074.115981541:9(87-98)Online publication date: 16-Sep-2006
  • (2006)Recursive modules for programmingACM SIGPLAN Notices10.1145/1160074.115981341:9(74-86)Online publication date: 16-Sep-2006
  • (2006)From structures and functors to modules and unitsProceedings of the eleventh ACM SIGPLAN international conference on Functional programming10.1145/1159803.1159815(87-98)Online publication date: 17-Sep-2006
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Media

Figures

Other

Tables

Share

Share

Share this Publication link

Share on social media