Abstract
A practical type system for ML-style recursive modules should address at least two technical challenges. First, it needs to solve the double vision problem, which refers to an inconsistency between external and internal views of recursive modules. Second, it needs to overcome the tension between practical decidability and expressivity which arises from the potential presence of cyclic type definitions caused by recursion between modules. Although type systems in previous proposals solve the double vision problem and are also decidable, they fail to typecheck common patterns of recursive modules, such as functor fixpoints, that are essential to the expressivity of the module system and the modular development of recursive modules. This paper proposes a novel type system for recursive modules that solves the double vision problem and typechecks common patterns of recursive modules including functor fixpoints. First, we design a type system with a type equivalence based on weak bisimilarity, which does not lend itself to practical implementation in general, but accommodates a broad range of cyclic type definitions. Then, we identify a practically implementable fragment using a type equivalence based on type normalization, which is expressive enough to typecheck typical uses of recursive modules. Our approach is purely syntactic and the definition of the type system is ready for use in an actual implementation.
- Amthing. https://forge.ocamlcore.org/projects/amthing/.Google Scholar
- Moscow ML. http://www.itu.dk/~sestoft/mosml.html.Google Scholar
- OCaml. http://caml.inria.fr/ocaml/.Google Scholar
- R. M. Amadio and L. Cardelli. Subtyping recursive types. ACM Transactions on Programming Languages and Systems, 15(4):575--631, September 1993. Google Scholar
Digital Library
- G. Bracha and G. Lindstrom. Modularity meets inheritance. In ICCL '92: Proceedings of the 1992 International Conference on Computer Languages, pages 282--290. IEEE Computer Society, 1992.Google Scholar
Cross Ref
- K. Crary, R. Harper, and S. Puri. What is a recursive module? In PLDI '99: Proceedings of the ACM SIGPLAN 1999 Conference on Programming Language Design and Implementation, pages 50--63, 1999. Google Scholar
Digital Library
- D. Dreyer. Recursive type generativity. Journal of Functional Programming, 17(4--5):433--471, 2007. Google Scholar
Digital Library
- D. Dreyer. A type system for recursive modules. In ICFP '07: Proceedings of the 12th ACM SIGPLAN International Conference on Functional Programming, pages 289--302, 2007. Google Scholar
Digital Library
- D. Dreyer. Understanding and Evolving the ML Module System. PhD thesis, Carnegie Mellon University, Pittsburgh, PA, USA, May 2005. Google Scholar
Digital Library
- D. Dreyer and A. Rossberg. Mixin' up the ML module system. In ICFP '08: Proceeding of the 13th ACM SIGPLAN International Conference on Functional Programming, pages 307--320, 2008. Google Scholar
Digital Library
- D. Duggan and C. Sourelis. Mixin modules. In ICFP '96: Proceedings of the first ACM SIGPLAN International Conference on Functional Programming, pages 262--273, 1996. Google Scholar
Digital Library
- M. Flatt and M. Felleisen. Units: Cool modules for HOT languages. In PLDI '98: Proceedings of the ACM SIGPLAN 1998 Conference on Programming Language Design and Implementation, pages 236--248, 1998. Google Scholar
Digital Library
- J. Garrigue. Private rows: Abstracting the unnamed. In APLAS '06: Proceedings of the 4th Asian Symposium on Programming Languages and Systems, pages 44--60. Springer-Verlag, 2006. Google Scholar
Digital Library
- J. Garrigue and K. Nakata. Path resolution for recursive nested modules. Available at http://www.math.nagoya-u.ac.jp/~garrigue/papers/, 2010.Google Scholar
- R. Harper and M. Lillibridge. A type-theoretic approach to higher-order modules with sharing. In POPL '94: Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 123--137, 1994. Google Scholar
Digital Library
- R. Harper, J. C. Mitchell, and E. Moggi. Higher-order modules and the phase distinction. In POPL '90: Proceedings of the 17th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 341--354, 1990. Google Scholar
Digital Library
- R. Harper and B. C. Pierce. Design considerations for ML-style module systems. In B. C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 8. MIT press, 2005.Google Scholar
- X. Leroy. Manifest types, modules, and separate compilation. In POPL '94: Proceedings of the 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 109--122, 1994. Google Scholar
Digital Library
- X. Leroy. Applicative functors and fully transparent higher-order modules. In POPL '95: Proceedings of the 22nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 142--153, 1995. Google Scholar
Digital Library
- X. Leroy. A syntactic theory of type generativity and sharing. Journal of Functional Programming, 6(05):667--698, 1996.Google Scholar
Cross Ref
- X. Leroy. A proposal for recursive modules in Objective Caml, 2003. Available at http://caml.inria.fr/about/papers.en.html.Google Scholar
- D. MacQueen. Modules for Standard ML. In LFP '84: Proceedings of the 1984 ACM Symposium on LISP and Functional Programming, pages 198--207, 1984. Google Scholar
Digital Library
- R. Milner. Communicating and mobile systems: the pi-calculus. Cambridge University Press, 1999. Google Scholar
Digital Library
- R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML (Revised). The MIT Press, 1997. Google Scholar
Digital Library
- B. Montagu. Programming with first-class modules in a core language with subtyping, singleton kinds and open existential types. PhD thesis, École Polytechnique, Palaiseau, France, December 2010.Google Scholar
- B. Montagu and D. Rémy. Modeling abstract types in modules with open existential types. In POPL '09: Proceedings of the 36th annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 354--365, 2009. Google Scholar
Digital Library
- K. Nakata. Bug report, nr. 0003674. http://caml.inria.fr/mantis/view.php?id=3674, 2005.Google Scholar
- K. Nakata and J. Garrigue. Recursive modules for programming. In ICFP '06: Proceedings of the eleventh ACM SIGPLAN International Conference on Functional Programming, pages 74--86, 2006. Google Scholar
Digital Library
- K. Nakata and T. Uustalu. Resumptions, weak bisimilarity and big-step semantics for While with interactive I/O: An exercise in mixed induction-coinduction. In SOS '10: Seventh Workshop on Structural Operational Semantics, pages 57--75, 2010.Google Scholar
Cross Ref
- M. Odersky, V. Cremet, C. Röckl, and M. Zenger. A nominal theory of objects with dependent types. In ECOOP '03: Proceedings of the 17th European Conference on Object-Oriented Programming, pages 201--224. Springer-Verlag, 2003.Google Scholar
Cross Ref
- C. Okasaki. Purely functional data structures. Cambridge University Press, 1998. Google Scholar
Digital Library
- S. Owens and M. Flatt. From structures and functors to modules and units. In ICFP '06: Proceedings of the eleventh ACM SIGPLAN International Conference on Functional Programming, pages 87--98, 2006. Google Scholar
Digital Library
- C. V. Russo. First-class structures for Standard ML. Nordic Journal of Computing, 7(4):348--374, 2000. Google Scholar
Digital Library
- C. V. Russo. Recursive structures for Standard ML. In ICFP '01: Proceedings of the sixth ACM SIGPLAN International Conference on Functional Programming, pages 50--61, 2001. Google Scholar
Digital Library
- N. Scharli, S. Ducasse, O. Nierstrasz, and A. Black. Traits: Composable units of behaviour. In ECOOP '03: Proceedings of the 17th European Conference on Object-Oriented Programming, pages 248--274. Springer-Verlag, 2003.Google Scholar
Cross Ref
- G. Sénizergues. The equivalence problem for deterministic pushdown automata is decidable. In ICALP '97: Proceedings of the 24th International Colloquium on Automata, Languages, and Programming, pages 671--681. Springer-Verlag, 1997. Google Scholar
Digital Library
- Z. Shao. Transparent modules with fully syntatic signatures. In ICFP '99: Proceedings of the fourth ACM SIGPLAN International Conference on Functional Programming, pages 220--232, 1999. Google Scholar
Digital Library
- M. Solomon. Type definitions with type parameters (extended abstract). In POPL '78: Proceedings of the 5th ACM Symposium on Principles of Programming Languages, pages 31--38, 1978. Full version available as technical report DAIMI PB-54. Google Scholar
Digital Library
- C. A. Stone and R. Harper. Deciding type equivalence in a language with singleton kinds. In POPL '00: Proceedings of the 27th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 214--227, 2000. Google Scholar
Digital Library
Index Terms
A syntactic type system for recursive modules
Recommendations
A syntactic type system for recursive modules
OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applicationsA practical type system for ML-style recursive modules should address at least two technical challenges. First, it needs to solve the double vision problem, which refers to an inconsistency between external and internal views of recursive 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. ...
Recursive type generativity
ICFP '05: Proceedings of the tenth ACM SIGPLAN international conference on Functional programmingExistential 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 ...







Comments