A promising approach to unifying functional and imperative programming paradigms is to localize mutation using linear or affine types. Haskell, a purely functional language, was recently extended with linear types by Bernardy et al., in the name of Linear Haskell. However, it remained unknown whether such a pure language could safely support non-local borrowing in the style of Rust, where each borrower can be freely split and dropped without direct communication of ownership back to the lender. We answer this question affirmatively with Pure Borrow, a novel framework that realizes Rust-style borrowing in Linear Haskell with purity. Notably, it features parallel state mutation with affine mutable references inside pure computation, unlike the IO and ST monads and existing Linear Haskell APIs. It also enjoys purity, lazy evaluation, first-class polymorphism and leak freedom, unlike Rust. We implement Pure Borrow simply as a library in Linear Haskell and demonstrate its power with a case study in parallel computing. We formalize the core of Pure Borrow and build a metatheory that works toward establishing safety, leak freedom and confluence, with a new, history-based model of borrowing.


翻译:一种有前景的统一函数式与命令式编程范式的方法是通过线性或仿射类型局部化可变性。Haskell作为一种纯函数式语言,近期由Bernardy等人以Linear Haskell之名扩展了线性类型。然而,尚不清楚这种纯语言能否安全地支持Rust风格的非局部借用——其中每个借用者可自由拆分与丢弃,无需向出借者直接通讯所有权。我们通过Pure Borrow(一种在Linear Haskell中实现Rust风格借用并保持纯度的新型框架)对此问题给出肯定回答。值得注意的是,该框架在纯计算内部实现了带仿射可变引用的并行状态可变性,不同于IO与ST单子及现有Linear Haskell API。与Rust不同,它兼具纯度、惰性求值、一等多态性与无泄漏特性。我们将Pure Borrow简单实现为Linear Haskell库,并通过并行计算案例研究展示其能力。我们形式化了Pure Borrow的核心机制,并建立元理论以通过基于借用历史的新模型来论证安全性、无泄漏性与合流性。

0
下载
关闭预览

相关内容

专知会员服务
78+阅读 · 2021年3月16日
【经典书】线性代数,399页pdf,Georgi Shilov经典本科教材
【经典书】线性代数,Linear Algebra,525页pdf
专知会员服务
79+阅读 · 2021年1月29日
【经典书】线性代数,352页pdf教你应该这样学
专知会员服务
107+阅读 · 2020年12月20日
一文读懂线性回归、岭回归和Lasso回归
CSDN
34+阅读 · 2019年10月13日
那些值得推荐和收藏的线性代数学习资源
放弃 RNN/LSTM 吧,因为真的不好用!望周知~
人工智能头条
19+阅读 · 2018年4月24日
线性回归:简单线性回归详解
专知
12+阅读 · 2018年3月10日
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年6月30日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Arxiv
0+阅读 · 4月23日
VIP会员
相关主题
最新内容
ICML 2026 | 自回归Boltzmann生成器重塑分子采样
专知会员服务
0+阅读 · 今天15:55
GNN跨域综述:从消息传递到图基础模型
专知会员服务
0+阅读 · 今天15:53
无人机自主控制与人工智能:系统性综述
专知会员服务
11+阅读 · 今天7:25
巡飞弹与反无人机系统——现代战场的两大支柱
专知会员服务
3+阅读 · 今天6:54
《打造“黄金舰队”》57页报告
专知会员服务
3+阅读 · 今天6:52
《北约数字教官网络发展路径》128页报告
专知会员服务
2+阅读 · 今天6:33
ECCV 2026 | MIMFlow:MIM与归一化流统一图像生成
专知会员服务
7+阅读 · 6月25日
网状网络及其在军事领域的运用
专知会员服务
8+阅读 · 6月25日
无美国参与的欧洲战争方式(万字长文)
专知会员服务
8+阅读 · 6月25日
《国防领域敏感性分析白皮书》
专知会员服务
9+阅读 · 6月25日
相关基金
国家自然科学基金
0+阅读 · 2017年12月31日
国家自然科学基金
6+阅读 · 2017年6月30日
国家自然科学基金
0+阅读 · 2015年12月31日
国家自然科学基金
1+阅读 · 2015年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
0+阅读 · 2014年12月31日
国家自然科学基金
3+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
国家自然科学基金
1+阅读 · 2014年12月31日
Top
微信扫码咨询专知VIP会员