Affiliation:
1. Inria, Paris, France / Université de Paris Cité, Paris, France
2. Inria, Paris, France
3. Inria, Lyon, France
Abstract
ML modules come as an additional layer on top of a core language to offer
large-scale notions of composition and abstraction. They largely
contributed to the success of OCaml and SML. While modules are easy to write
for common cases, their advanced use may become tricky. Additionally,
despite a long line of works, their meta-theory remains difficult to
comprehend, with involved soundness proofs. In fact, the module layer of
OCaml does not currently have a formal specification and its implementation
has some surprising behaviors.
Building on previous translations from ML modules to Fω, we propose a type
system, called Mω, that covers a large subset of OCaml modules, including
both applicative and generative functors, and extended with transparent
ascription. This system produces signatures in an OCaml-like syntax extended
with Fω quantifiers. We provide a reverse translation from Mω signatures to
path-based source signatures along with a characterization of signature
avoidance cases, making Mω signatures well suited to serve as a new internal
representation for a typechecker.
The soundness of the type system is shown by elaboration in Fω. We improve
over previous encodings of sealing within applicative functors, by the
introduction of transparent existential types, a weaker form of existential
types that can be lifted out of universal and arrow types. This shines a new
light on the form of abstraction provided by applicative functors and brings
their treatment much closer to those of generative functors.
Publisher
Association for Computing Machinery (ACM)
Cited by
1 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Fulfilling OCaml Modules with Transparency;Proceedings of the ACM on Programming Languages;2024-04-29