skip to main content
research-article

A syntactic type system for recursive modules

Authors Info & Claims
Published:22 October 2011Publication History
Skip Abstract Section

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/.Google ScholarGoogle Scholar
  2. Moscow ML. http://www.itu.dk/~sestoft/mosml.html.Google ScholarGoogle Scholar
  3. OCaml. http://caml.inria.fr/ocaml/.Google ScholarGoogle Scholar
  4. R. M. Amadio and L. Cardelli. Subtyping recursive types. ACM Transactions on Programming Languages and Systems, 15(4):575--631, September 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle ScholarCross RefCross Ref
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. D. Dreyer. Recursive type generativity. Journal of Functional Programming, 17(4--5):433--471, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. D. Dreyer. Understanding and Evolving the ML Module System. PhD thesis, Carnegie Mellon University, Pittsburgh, PA, USA, May 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. J. Garrigue and K. Nakata. Path resolution for recursive nested modules. Available at http://www.math.nagoya-u.ac.jp/~garrigue/papers/, 2010.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. X. Leroy. A syntactic theory of type generativity and sharing. Journal of Functional Programming, 6(05):667--698, 1996.Google ScholarGoogle ScholarCross RefCross Ref
  21. X. Leroy. A proposal for recursive modules in Objective Caml, 2003. Available at http://caml.inria.fr/about/papers.en.html.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. R. Milner. Communicating and mobile systems: the pi-calculus. Cambridge University Press, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML (Revised). The MIT Press, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. K. Nakata. Bug report, nr. 0003674. http://caml.inria.fr/mantis/view.php?id=3674, 2005.Google ScholarGoogle Scholar
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle ScholarCross RefCross Ref
  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.Google ScholarGoogle ScholarCross RefCross Ref
  31. C. Okasaki. Purely functional data structures. Cambridge University Press, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. C. V. Russo. First-class structures for Standard ML. Nordic Journal of Computing, 7(4):348--374, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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.Google ScholarGoogle ScholarCross RefCross Ref
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library
  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. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A syntactic 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 46, Issue 10
            OOPSLA '11
            October 2011
            1063 pages
            ISSN:0362-1340
            EISSN:1558-1160
            DOI:10.1145/2076021
            Issue’s Table of Contents
            • 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

            Copyright © 2011 ACM

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 22 October 2011

            Check for updates

            Qualifiers

            • research-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!