当前位置: X-MOL 学术J. Funct. Program. › 论文详情
Our official English website, www.x-mol.net, welcomes your feedback! (Note: you will need to create a separate account there.)
1ML – Core and modules united
Journal of Functional Programming ( IF 1.1 ) Pub Date : 2018-12-27 , DOI: 10.1017/s0956796818000205
ANDREAS ROSSBERG

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 imposes seemingly unnecessary limits on expressiveness because it makes modules second-class citizens of the language. For example, selecting one among several possible modules implementing a given interface 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 and tend to be even more syntactically heavyweight than using second-class modules alone. We propose a redesign of ML in which modules are truly first-class values, and core and module layers are unified into one language. In this “1ML”, functions, functors, and even type constructors are one and the same construct; likewise, no distinction is needed 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: its type structure is expressible in terms of plain System Fω, with 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.

中文翻译:

1ML – 核心和模块结合

ML 是两种语言合二为一:有, 有类型和表达式,并且有模块,带有签名、结构和函子。模块在核心之上形成一个独立的、高阶的函数式语言。这种分层既有实际原因,也有技术原因;然而,它在语法和语义上造成了大量重复,并且对表达性施加了看似不必要的限制,因为它使模块成为该语言的二等公民。例如,在实现给定接口的几个可能模块中选择一个不能成为动态决策。已经提出并以不同的变体实现了允许将模块打包为一流值的语言扩展。然而,它们仅在一定程度上弥补了表现力,并且往往比单独使用二等模块在语法上更加重量级。我们建议重新设计 ML,其中模块是真正的一流价值,核心层和模块层统一为一种语言。在这个“1ML”中,函数、函子甚至类型构造函数都是同一个构造;同样,不需要区分结构、记录或元组。或者反过来看,一切都只是(“一种使用模式”)模块。然而,1ML 不需要依赖类型:它的类型结构可以用普通的 System F 来表达ω,与我们的微小变化模块方法。我们引入了 1ML 的显式类型版本和带有 Damas-Milner 式隐式量化的扩展。这种语言的类型推断并不完整,但我们认为,它并不比标准 ML 差很多。
更新日期:2018-12-27
down
wechat
bug