skip to main content
10.1145/2048066.2048141acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

A syntactic type system for recursive modules

Published: 22 October 2011 Publication History

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.

References

[1]
Amthing. https://forge.ocamlcore.org/projects/amthing/.
[2]
Moscow ML. http://www.itu.dk/~sestoft/mosml.html.
[3]
OCaml. http://caml.inria.fr/ocaml/.
[4]
R. M. Amadio and L. Cardelli. Subtyping recursive types. ACM Transactions on Programming Languages and Systems, 15(4):575--631, September 1993.
[5]
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.
[6]
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.
[7]
D. Dreyer. Recursive type generativity. Journal of Functional Programming, 17(4--5):433--471, 2007.
[8]
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.
[9]
D. Dreyer. Understanding and Evolving the ML Module System. PhD thesis, Carnegie Mellon University, Pittsburgh, PA, USA, May 2005.
[10]
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.
[11]
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.
[12]
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.
[13]
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.
[14]
J. Garrigue and K. Nakata. Path resolution for recursive nested modules. Available at http://www.math.nagoya-u.ac.jp/~garrigue/papers/, 2010.
[15]
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.
[16]
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.
[17]
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.
[18]
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.
[19]
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.
[20]
X. Leroy. A syntactic theory of type generativity and sharing. Journal of Functional Programming, 6(05):667--698, 1996.
[21]
X. Leroy. A proposal for recursive modules in Objective Caml, 2003. Available at http://caml.inria.fr/about/papers.en.html.
[22]
D. MacQueen. Modules for Standard ML. In LFP '84: Proceedings of the 1984 ACM Symposium on LISP and Functional Programming, pages 198--207, 1984.
[23]
R. Milner. Communicating and mobile systems: the pi-calculus. Cambridge University Press, 1999.
[24]
R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML (Revised). The MIT Press, 1997.
[25]
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.
[26]
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.
[27]
K. Nakata. Bug report, nr. 0003674. http://caml.inria.fr/mantis/view.php?id=3674, 2005.
[28]
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.
[29]
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.
[30]
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.
[31]
C. Okasaki. Purely functional data structures. Cambridge University Press, 1998.
[32]
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.
[33]
C. V. Russo. First-class structures for Standard ML. Nordic Journal of Computing, 7(4):348--374, 2000.
[34]
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.
[35]
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.
[36]
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.
[37]
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.
[38]
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.
[39]
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.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applications
October 2011
1104 pages
ISBN:9781450309400
DOI:10.1145/2048066
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 46, Issue 10
    OOPSLA '11
    October 2011
    1063 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2076021
    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: 22 October 2011

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. abstract types
  2. modules
  3. recursion
  4. type systems
  5. weak bisimulations

Qualifiers

  • Research-article

Conference

SPLASH '11
Sponsor:

Acceptance Rates

Overall Acceptance Rate 268 of 1,244 submissions, 22%

Upcoming Conference

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)8
  • Downloads (Last 6 weeks)2
Reflects downloads up to 15 Feb 2025

Other Metrics

Citations

Cited By

View all
  • (2025)Algebraic Stepper for Simple ModulesProceedings of the 2025 ACM SIGPLAN International Workshop on Partial Evaluation and Program Manipulation10.1145/3704253.3706137(13-29)Online publication date: 10-Jan-2025
  • (2015)FᴏᴏProceedings of the 17th Workshop on Formal Techniques for Java-like Programs10.1145/2786536.2786540(1-4)Online publication date: 7-Jul-2015
  • (2015)IsoLATEProceedings of the 24th European Symposium on Programming on Programming Languages and Systems - Volume 903210.1007/978-3-662-46669-8_11(257-282)Online publication date: 11-Apr-2015
  • (2014)BackpackACM SIGPLAN Notices10.1145/2578855.253588449:1(19-31)Online publication date: 8-Jan-2014
  • (2014)BackpackProceedings of the 41st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages10.1145/2535838.2535884(19-31)Online publication date: 11-Jan-2014
  • (2013)Mixin’ Up the ML Module SystemACM Transactions on Programming Languages and Systems (TOPLAS)10.1145/2450136.245013735:1(1-84)Online publication date: 1-Apr-2013
  • (2013)Contractive signatures with recursive types, type parameters, and abstract typesProceedings of the 40th international conference on Automata, Languages, and Programming - Volume Part II10.1007/978-3-642-39212-2_28(299-311)Online publication date: 8-Jul-2013

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media