skip to main content
10.1145/2784731.2784738acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article
Open Access

1ML – core and modules united (F-ing first-class modules)

Published:29 August 2015Publication History

ABSTRACT

ML is two languages in one: there is the core, with types and expressions, and there are modules, with signatures, structures and functors. Modules form a separate, higher-order functional language on top of the core. There are both practical and technical reasons for this stratification; yet, it creates substantial duplication in syntax and semantics, and it reduces expressiveness. For example, selecting a module cannot be made a dynamic decision. Language extensions allowing modules to be packaged up as first-class values have been proposed and implemented in different variations. However, they remedy expressiveness only to some extent, are syntactically cumbersome, and do not alleviate redundancy. We propose a redesign of ML in which modules are truly first-class values, and core and module layer are unified into one language. In this "1ML", functions, functors, and even type constructors are one and the same construct; likewise, no distinction is made between structures, records, or tuples. Or viewed the other way round, everything is just ("a mode of use of") modules. Yet, 1ML does not require dependent types, and its type structure is expressible in terms of plain System Fω, in a minor variation of our F-ing modules approach. We introduce both an explicitly typed version of 1ML, and an extension with Damas/Milner-style implicit quantification. Type inference for this language is not complete, but, we argue, not substantially worse than for Standard ML. An alternative view is that 1ML is a user-friendly surface syntax for System Fω that allows combining term and type abstraction in a more compositional manner than the bare calculus.

References

  1. H. Barendregt. Lambda calculi with types. In S. Abramsky, D. Gabbay, and T. Maibaum, editors, Handbook of Logic in Computer Science, vol. 2, chapter 2, pages 117–309. Oxford University Press, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. S. K. Biswas. Higher-order functors with transparent signatures. In POPL, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. L. Damas and R. Milner. Principal type-schemes for functional programs. In POPL, 1982. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. D. Dreyer. Understanding and Evolving the ML Module System. PhD thesis, CMU, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. D. Dreyer and M. Blume. Principal type schemes for modular programs. In ESOP, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. D. Dreyer, K. Crary, and R. Harper. A type system for higher-order modules. In POPL, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. J. Garrigue and A. Frisch. First-class modules and composable signatures in Objective Caml 3.12. In ML, 2010.Google ScholarGoogle Scholar
  8. J. Garrigue and D. Rémy. Semi-explicit first-class polymorphism for ML. Information and Computation, 155(1-2), 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. R. Harper and M. Lillibridge. A type-theoretic approach to higherorder modules with sharing. In POPL, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. R. Harper and J. C. Mitchell. On the type structure of Standard ML. In ACM TOPLAS, volume 15(2), 1993. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. R. Harper, J. C. Mitchell, and E. Moggi. Higher-order modules and the phase distinction. In POPL, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. R. Harper and B. Pierce. Design considerations for ML-style module systems. In B. C. Pierce, editor, Advanced Topics in Types and Programming Languages, chapter 8, pages 293–346. MIT Press, 2005.Google ScholarGoogle Scholar
  13. R. Harper and C. Stone. A type-theoretic interpretation of Standard ML. In Proof, Language, and Interaction: Essays in Honor of Robin Milner. MIT Press, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. Le Botlan and D. Rémy. MLF: Raising ML to the power of System F. In ICFP, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. X. Leroy. Applicative functors and fully transparent higher-order modules. In POPL, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. M. Lillibridge. Translucent Sums: A Foundation for Higher-Order Module Systems. PhD thesis, CMU, 1997.Google ScholarGoogle Scholar
  17. D. MacQueen. Using dependent types to express modular structure. In POPL, 1986. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. R. Milner. A theory of type polymorphism in programming languages. JCSS, 17:348–375, 1978.Google ScholarGoogle ScholarCross RefCross Ref
  19. R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML (Revised). MIT Press, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. J. C. Mitchell and G. D. Plotkin. Abstract types have existential type. ACM TOPLAS, 10(3):470–502, July 1988. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. D. Rémy. Records and variants as a natural extension of ML. In POPL, 1989.Google ScholarGoogle Scholar
  22. A. Rossberg. The Missing Link – Dynamic components for ML. In ICFP, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. A. Rossberg. 1ML – Core and modules united (Technical Appendix), 2015. mpi-sws.org/˜rossberg/1ml/.Google ScholarGoogle Scholar
  24. A. Rossberg and D. Dreyer. Mixin’ up the ML module system. ACM TOPLAS, 35(1), 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. A. Rossberg, C. Russo, and D. Dreyer. F-ing modules. JFP, 24(5):529–607, 2014.Google ScholarGoogle Scholar
  26. C. Russo. Non-dependent types for Standard ML modules. In PPDP, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. C. Russo. First-class structures for Standard ML. Nordic Journal of Computing, 7(4):348–374, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. C. Russo. Types for Modules. ENTCS, 60, 2003.Google ScholarGoogle Scholar
  29. C. Russo and D. Vytiniotis. QML: Explicit first-class polymorphism for ML. In ML, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Z. Shao. Transparent modules with fully syntactic signatures. In ICFP, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. C. A. Stone and R. Harper. Extensional equivalence and singleton types. ACM TOCL, 7(4):676–722, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. J.-P. Talpin and P. Jouvelot. Polymorphic type, region and effect inference. JFP, 2(3):245271, 1992.Google ScholarGoogle Scholar
  33. D. Vytiniotis, S. Weirich, and S. Peyton Jones. FPH: First-class polymorphism for Haskell. In ICFP, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. P. Wadler and S. Blott. How to make ad-hoc polymorphism less ad hoc. In POPL, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. A. Wright. Simple imperative polymorphism. LASC,8:343–356, 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. 1ML – core and modules united (F-ing first-class 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
          • Published in

            cover image ACM Conferences
            ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming
            August 2015
            436 pages
            ISBN:9781450336697
            DOI:10.1145/2784731
            • cover image ACM SIGPLAN Notices
              ACM SIGPLAN Notices  Volume 50, Issue 9
              ICFP '15
              September 2015
              436 pages
              ISSN:0362-1340
              EISSN:1558-1160
              DOI:10.1145/2858949
              • Editor:
              • Andy Gill
              Issue’s Table of Contents

            Copyright © 2015 ACM

            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 the author(s) 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].

            Publisher

            Association for Computing Machinery

            New York, NY, United States

            Publication History

            • Published: 29 August 2015

            Permissions

            Request permissions about this article.

            Request Permissions

            Check for updates

            Qualifiers

            • research-article

            Acceptance Rates

            Overall Acceptance Rate333of1,064submissions,31%

            Upcoming Conference

            ICFP '24

          PDF Format

          View or Download as a PDF file.

          PDF

          eReader

          View online with eReader.

          eReader