1ML - ML with true first-class modules, “everything is a module” (old) (people.mpi-sws.org)
from armchair_progamer@programming.dev to programming_languages@programming.dev on 20 Apr 2024 07:51

Project has been dead for several years but the idea seems interesting.

Abstract from the original paper:

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.


threaded - newest

porgamrer@programming.dev on 20 Apr 2024 20:39 collapse

I was quite interested in this project at the time, but I never saw any examples that could convey how this module system works, or what it makes possible.

I still have no idea today. It seems like a shame, as the high-level outline sounds great.