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.
- Roberto Amadio and Luca Cardelli. Subtyping recursive types. ACM Transactions on Programming Languages and Systems, 15(4):575--631, 1993. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Derek Dreyer. Practical type theory for recursive modules. Technical Report TR-2006-07, University of Chicago, Department of Computer Science, August 2006.Google Scholar
- Derek Dreyer. A type system for recursive modules. Technical Report TR-2007-10, University of Chicago, Department of Computer Science, July 2007a.Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Derek Dreyer. Understanding and Evolving the ML Module System. PhD thesis, Carnegie Mellon University, Pittsburgh, Pennsylvania, 2005. Google Scholar
Digital Library
- Derek Dreyer and Matthias Blume. Principal type schemes for modular programs. In European Symposium on Programming (ESOP), pages 441--457, Braga, Portugal, 2007. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Warren D. Goldfarb. The undecidability of the second-order unification problem. Theoretical Computer Science, 13:225--230, 1981.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- Fritz Henglein. Type inference with polymorphic recursion. ACM Transactions on Programming Languages and Systems, 15(2):253--289, 1993. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Xavier Leroy. A proposal for recursive modules in Objective Caml, 2003. Available at: http://caml.inria.fr/about/papers.en.html.Google Scholar
- David MacQueen. Modules for Standard ML. In ACM Symposium on LISP and Functional Programming, pages 198--207, 1984. Google Scholar
Digital Library
- Robin Milner, Mads Tofte, Robert Harper, and David MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- Chris Okasaki. Purely Functional Data Structures. Cambridge University Press, 1998. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- Claudio V. Russo. Recursive structures for Standard ML. In International Conference on Functional Programming (ICFP), pages 50--61, Florence, Italy, 2001. Google Scholar
Digital Library
- Claudio V. Russo. Types for Modules. PhD thesis, Edinburgh University, Edinburgh, Scotland, 1998. LFCS Thesis ECS-LFCS-98-389.Google Scholar
- Mads Tofte. Operational Semantics and Polymorphic Type Inference. PhD thesis, University of Edinburgh, 1988.Google Scholar
Index Terms
A type system for recursive modules
Recommendations
F-ing modules
TLDI '10: Proceedings of the 5th ACM SIGPLAN workshop on Types in language design and implementationML modules are a powerful language mechanism for decomposing programs into reusable components. Unfortunately, they also have a reputation for being "complex" and requiring fancy type theory that is mostly opaque to non-experts. While this reputation is ...
Mixin’ Up the ML Module System
ML modules provide hierarchical namespace management, as well as fine-grained control over the propagation of type information, but they do not allow modules to be broken up into mutually recursive, separately compilable components. Mixin modules ...
A type system for recursive modules
ICFP '07: Proceedings of the 12th ACM SIGPLAN international conference on Functional programmingThere 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. ...







Comments