Skip to main content
×
Home
    • Aa
    • Aa

F-ing modules

  • ANDREAS ROSSBERG (a1), CLAUDIO RUSSO (a2) and DEREK DREYER (a3)
Abstract
Abstract

ML 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 certainly understandable, given the many non-standard methodologies that have been developed in the process of studying modules, we aim here to demonstrate that it is undeserved. To do so, we present a novel formalization of ML modules, which defines their semantics directly by a compositional “elaboration” translation into plain System Fω (the higher-order polymorphic λ-calculus). To demonstrate the scalability of our “F-ing” semantics, we use it to define a representative, higher-order ML-style module language, encompassing all the major features of existing ML module dialects (except for recursive modules). We thereby show that ML modules are merely a particular mode of use of System Fω.

To streamline the exposition, we present the semantics of our module language in stages. We begin by defining a subset of the language supporting a Standard ML-like language with second-class modules and generative functors. We then extend this sublanguage with the ability to package modules as first-class values (a very simple extension, as it turns out) and OCaml-style applicative functors (somewhat harder). Unlike previous work combining both generative and applicative functors, we do not require two distinct forms of functor or signature sealing. Instead, whether a functor is applicative or not depends only on the computational purity of its body. In fact, we argue that applicative/generative is rather incidental terminology for pure versus impure functors. This approach results in a semantics that we feel is simpler and more natural than previous accounts, and moreover prohibits breaches of abstraction safety that were possible under them.

    • Send article to Kindle

      To send this article to your Kindle, first ensure coreplatform@cambridge.org is added to your Approved Personal Document E-mail List under your Personal Document Settings on the Manage Your Content and Devices page of your Amazon account. Then enter the ‘name’ part of your Kindle email address below. Find out more about sending to your Kindle.

      Note you can select to send to either the @free.kindle.com or @kindle.com variations. ‘@free.kindle.com’ emails are free but can only be sent to your device when it is connected to wi-fi. ‘@kindle.com’ emails can be delivered even when you are not connected to wi-fi, but note that service fees apply.

      Find out more about the Kindle Personal Document Service.

      F-ing modules
      Available formats
      ×
      Send article to Dropbox

      To send this article to your Dropbox account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your Dropbox account. Find out more about sending content to Dropbox.

      F-ing modules
      Available formats
      ×
      Send article to Google Drive

      To send this article to your Google Drive account, please select one or more formats and confirm that you agree to abide by our usage policies. If this is the first time you use this feature, you will be asked to authorise Cambridge Core to connect with your Google Drive account. Find out more about sending content to Google Drive.

      F-ing modules
      Available formats
      ×
Copyright
Linked references
Hide All

This list contains references from the content that can be linked to their source. For a full set of references and notes please see the PDF or HTML where available.

G. Ghelli & B. Pierce . (1998) Bounded existentials and minimal typing. Theor. Comput. Sci. 193 (1-2), 7596.

W.D. Goldfarb (1981) The undecidability of the second-order unification problem. Theor. Comput. Sci. 13, 225230.

R. Harper & J. C. Mitchell (1993) On the type structure of Standard ML. ACM Trans. Program. Lang. Syst. 15 (2), 211252.

G. Kuan & D. MacQueen . (2010) Engineering higher-order modules in SML/NJ. In International Symposium on the Implementation and Application of Functional Languages. Lecture Notes in Computer Science, Volume 6041, 2010, pp 218235.

J. Launchbury & S. L. Peyton Jones (1995) State in Haskell. LISP Symbol. Comput. 8 (4), 293341.

X. Leroy (2000) A modular module system. J. Funct. Program. 10 (3), 269303.

J. C. Mitchell & G. D. Plotkin (1988) Abstract types have existential type. ACM Trans. Program. Lang. Syst. 10 (3), 470502.

L. C. Paulson (1996) ML for the Working Programmer, 2nd ed.Cambridge University Press.

C. V. Russo (2003) Types for modules. In Electronic Notes in Theoretical Computer Science, 60, 3421.

C. A. Stone & R. Harper (2006) Extensional equivalence and singleton types. ACM Trans. Comput. Log. 7 (4), 676722.

Recommend this journal

Email your librarian or administrator to recommend adding this journal to your organisation's collection.

Journal of Functional Programming
  • ISSN: 0956-7968
  • EISSN: 1469-7653
  • URL: /core/journals/journal-of-functional-programming
Please enter your name
Please enter a valid email address
Who would you like to send this to? *
×

Metrics

Full text views

Total number of HTML views: 0
Total number of PDF views: 46 *
Loading metrics...

Abstract views

Total abstract views: 74 *
Loading metrics...

* Views captured on Cambridge Core between September 2016 - 25th March 2017. This data will be updated every 24 hours.