paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Modal FRP for all: Functional reactive programming without space leaks in Haskell

面向所有人的模态 FRP:在 Haskell 中无空间泄漏的函数响应式编程
JFP vol.322022匹配度 2/10 · 这是一篇纯 PL/类型系统方向的论文,研究模态类型系统用于保证 FRP 程序的因果性、生产率与无空间泄漏。虽然属于编程语言与静态保证领域,且兼具理论(Coq 机械化)与工程实现,但与用户关注的核心方向(ML/Agentic 程序的静态分析、LLM 与静态分析/形式化验证的双向结合、浮点程序分析、贝叶斯程序分析)均无直接交集。引用 8 inbox
PATRICK BAHR
crossref: 2026-09-10

AI 速览

一句话:提出并实现 Rattus:一种简化模态类型系统、可浅层嵌入 Haskell 且保证因果性、生产率与无空间泄漏的模态 FRP 语言。

函数响应式编程(FRP)提供声明式高层接口,但需保证程序因果且不产生空间泄漏。模态类型近年被用来保证这些操作性质,但此前演算较复杂。本文提出 Rattus:一种扩展并简化先前模态 FRP 演算的语言,在保持生产率、因果性和无空间泄漏保证的同时,使类型系统更实用。作者将 Rattus 浅层嵌入 Haskell,可用熟悉的 Haskell 语法编写并与普通 Haskell 代码无缝集成,从而兼得 Yampa 等 FRP 库的生态与定制类型系统的操作保证。论文用 Coq 完全机器化逻辑关系证明类型可靠性,据此建立生产率、因果性和内存性质。

问题
如何让高层声明式 FRP 程序既具因果性、可高效执行且无空间泄漏,又能与通用函数式语言及其库生态结合。
方法
设计简化模态类型系统的 Rattus 语言,并将其浅层嵌入 Haskell,支持以 Haskell 语法编写和与普通 Haskell 代码集成。
评估
在 Coq 中完全机器化地构造逻辑关系证明类型可靠性,以证明语言的生产率、因果性和内存性质。
原文摘要(Abstract)

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.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@article{paperbot1629,
  title = {Modal FRP for all: Functional reactive programming without space leaks in Haskell},
  author = {PATRICK BAHR},
  journal = {Journal of Functional Programming},
  volume = {32},
  year = {2022},
  doi = {10.1017/s0956796822000132}
}