skip to main content
article

A type system for recursive modules

Published:01 October 2007Publication History
Skip Abstract Section

Abstract

There has been much work in recent years on extending ML with recursive modules. One of the most difficult problems in the development of such an extension is the double vision problem, which concerns the interaction of recursion and data abstraction. In previous work, I defined a type system called RTG, which solves the double vision problem at the level of a System-F-style core calculus. In this paper, I scale the ideas and techniques of RTG to the level of a recursive ML-style module calculus called RMC, thus establishing that no tradeoff between data abstraction and recursive modules is necessary. First, I describe RMC's typing rules for recursive modules informally and discuss some of the design questions that arose in developing them. Then, I present the formal semantics of RMC, which is interesting in its own right. The formalization synthesizes aspects of both the Definition and the Harper-Stone interpretation of Standard ML, and includes a novel two-pass algorithm for recursive module typechecking in which the coherence of the two passes is emphasized by their representation in terms of the same set of inference rules.

References

  1. Roberto Amadio and Luca Cardelli. Subtyping recursive types. ACM Transactions on Programming Languages and Systems, 15(4):575--631, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Karl Crary, Robert Harper, and Sidd Puri. What is a recursive module? In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), pages 50--63, Atlanta, Georgia, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Derek Dreyer. Practical type theory for recursive modules. Technical Report TR-2006-07, University of Chicago, Department of Computer Science, August 2006.Google ScholarGoogle Scholar
  4. Derek Dreyer. A type system for recursive modules. Technical Report TR-2007-10, University of Chicago, Department of Computer Science, July 2007a.Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Derek Dreyer. Recursive type generativity. Journal of Functional Programming, 2007b. To appear. Original version published in 2005 ACM SIGPLAN International Conference on Functional Programming (ICFP), pages 41--53, Tallinn, Estonia. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Derek Dreyer. Understanding and Evolving the ML Module System. PhD thesis, Carnegie Mellon University, Pittsburgh, Pennsylvania, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Derek Dreyer and Matthias Blume. Principal type schemes for modular programs. In European Symposium on Programming (ESOP), pages 441--457, Braga, Portugal, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Derek Dreyer, Karl Crary, and Robert Harper. A type system for higher-order modules. In ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), New Orleans, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. 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, Montréal, Canada, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Warren D. Goldfarb. The undecidability of the second-order unification problem. Theoretical Computer Science, 13:225--230, 1981.Google ScholarGoogle Scholar
  11. Robert Harper and Mark Lillibridge. A type-theoretic approach to higher-order modules with sharing. In ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), pages 123--137, Portland, Oregon, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Robert Harper and Benjamin C. Pierce. Design considerations for ML-style module systems. In Benjamin C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 8. MIT Press, 2005.Google ScholarGoogle Scholar
  13. Robert Harper and Chris Stone. A type-theoretic interpretation of Standard ML. In Gordon Plotkin, Colin Stirling, and Mads Tofte, editors, Proof, Language, and Interaction: Essays in Honor of Robin Milner, pages 341--387. MIT Press, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Fritz Henglein. Type inference with polymorphic recursion. ACM Transactions on Programming Languages and Systems, 15(2):253--289, 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Xavier Leroy. Applicative functors and fully transparent higher-order modules. In ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), pages 142--153, San Francisco, California, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Xavier Leroy. Manifest types, modules, and separate compilation. In ACM SIGPLAN Symposium on Principles of Programming Languages (POPL), pages 109--122, Portland, Oregon, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Xavier Leroy. A proposal for recursive modules in Objective Caml, 2003. Available at: http://caml.inria.fr/about/papers.en.html.Google ScholarGoogle Scholar
  18. David MacQueen. Modules for Standard ML. In ACM Symposium on LISP and Functional Programming, pages 198--207, 1984. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. John C. Mitchell and Gordon D. Plotkin. Abstract types have existential type. ACM Transactions on Programming Languages and Systems, 10(3):470--502, 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Keiko Nakata and Jacques Garrigue. Recursive modules for programming. In ACM SIGPLAN International Conference on Functional Programming (ICFP), pages 74--86, Portland, Oregon, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Chris Okasaki. Purely Functional Data Structures. Cambridge University Press, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Scott Owens and Matthew Flatt. From structures and functors to modules and units. In ACM SIGPLAN International Conference on Functional Programming (ICFP), pages 87--98, Portland, Oregon, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Claudio V. Russo. Recursive structures for Standard ML. In International Conference on Functional Programming (ICFP), pages 50--61, Florence, Italy, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Claudio V. Russo. Types for Modules. PhD thesis, Edinburgh University, Edinburgh, Scotland, 1998. LFCS Thesis ECS-LFCS-98-389.Google ScholarGoogle Scholar
  26. Mads Tofte. Operational Semantics and Polymorphic Type Inference. PhD thesis, University of Edinburgh, 1988.Google ScholarGoogle Scholar

Index Terms

  1. A type system for recursive modules

              Recommendations

              Comments

              Login options

              Check if you have access through your login credentials or your institution to get full access on this article.

              Sign in

              Full Access

              • Published in

                cover image ACM SIGPLAN Notices
                ACM SIGPLAN Notices  Volume 42, Issue 9
                Proceedings of the ICFP '07 conference
                September 2007
                331 pages
                ISSN:0362-1340
                EISSN:1558-1160
                DOI:10.1145/1291220
                Issue’s Table of Contents
                • cover image ACM Conferences
                  ICFP '07: Proceedings of the 12th ACM SIGPLAN international conference on Functional programming
                  October 2007
                  346 pages
                  ISBN:9781595938152
                  DOI:10.1145/1291151

                Copyright © 2007 ACM

                Publisher

                Association for Computing Machinery

                New York, NY, United States

                Publication History

                • Published: 1 October 2007

                Check for updates

                Qualifiers

                • article

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader
              About Cookies On This Site

              We use cookies to ensure that we give you the best experience on our website.

              Learn more

              Got it!