一句话:提出并实现 Rattus:一种简化模态类型系统、可浅层嵌入 Haskell 且保证因果性、生产率与无空间泄漏的模态 FRP 语言。
函数响应式编程(FRP)提供声明式高层接口,但需保证程序因果且不产生空间泄漏。模态类型近年被用来保证这些操作性质,但此前演算较复杂。本文提出 Rattus:一种扩展并简化先前模态 FRP 演算的语言,在保持生产率、因果性和无空间泄漏保证的同时,使类型系统更实用。作者将 Rattus 浅层嵌入 Haskell,可用熟悉的 Haskell 语法编写并与普通 Haskell 代码无缝集成,从而兼得 Yampa 等 FRP 库的生态与定制类型系统的操作保证。论文用 Coq 完全机器化逻辑关系证明类型可靠性,据此建立生产率、因果性和内存性质。
Abstract Functional reactive programming (FRP) provides a high-level interface for implementing reactive systems in a declarative manner. However, this high-level interface has to be carefully reigned in to ensure that programs can in fact be executed in practice. Specifically, one must ensure that FRP programs are causal and can be implemented without introducing space leaks. In recent years, modal types have been demonstrated to be an effective tool to ensure these operational properties. In this paper, we present $\mathsf{Rattus}$ , a modal FRP language that extends and simplifies previous modal FRP calculi while still maintaining the operational guarantees for productivity, causality, and space leaks. The simplified type system makes $\mathsf{Rattus}$ a practical programming language that can be integrated with existing functional programming languages. To demonstrate this, we have implemented a shallow embedding of $\mathsf{Rattus}$ in Haskell that allows the programmer to write $\mathsf{Rattus}$ code in familiar Haskell syntax and seamlessly integrate it with regular Haskell code. Thus, $\mathsf{Rattus}$ combines the benefits enjoyed by FRP libraries such as Yampa, namely access to a rich library ecosystem (e.g., for graphics programming), with the strong operational guarantees offered by a bespoke type system. To establish the productivity, causality, and memory properties of the language, we prove type soundness using a logical relations argument fully mechanised in the Coq proof assistant.