Pure Borrow: Linear Haskell Meets Rust-Style Borrowing
Yusuke Matsushita, Hiromi Ishii
摘要
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.
问 Lune
几分钟读透这篇 Paper,不用再花一下午。
Lune 能读完全文,也能读引用它的顶会 Paper,讲清它的结论、证据和局限,每一点都注明出自哪篇 Paper。不用硬啃,也不靠猜。
脉络
- Nola: Later-Free Ghost State for Verifying Termination in Iris 引用了 RustBelt meets relaxed memory
- Nola: Later-Free Ghost State for Verifying Termination in Iris 引用了 RustHornBelt: a semantic foundation for functional verification of Rust programs with unsafe code
- Nola: Later-Free Ghost State for Verifying Termination in Iris 引用了 RefinedRust: A Type System for High-Assurance Verification of Rust Programs
- RefinedRust: A Type System for High-Assurance Verification of Rust Programs 引用了 RustHornBelt: a semantic foundation for functional verification of Rust programs with unsafe code
它引用的 Paper7
- RustBelt meets relaxed memoryHoang-Hai Dang, Jacques-Henri Jourdan, Jan-Oliver Kaiser, Derek DreyerPOPL 2020 · 68 次引用
- RustHornBelt: a semantic foundation for functional verification of Rust programs with unsafe codeYusuke Matsushita, Xavier Denis, Jacques-Henri Jourdan, Derek DreyerPLDI 2022 · 44 次引用
- RefinedRust: A Type System for High-Assurance Verification of Rust ProgramsLennard Gäher, Michael Sammler, Ralf Jung, Robbert Krebbers 等PLDI 2024 · 29 次引用
- Data Race Freedom à la ModeAïna Linn Georges, Benjamin Peters, Laila Elbeheiry, Leo White 等POPL 2025 · 6 次引用
- Nola: Later-Free Ghost State for Verifying Termination in IrisYusuke Matsushita, Takeshi TsukadaPLDI 2025 · 2 次引用
相关 Paper
- From Linearity to BorrowingAndrew Wagner, Olek Gierczak, Brianna Marshall, John M. Li 等OOPSLA 2025 · 1 次引用
- Efficient Parallel Functional Programming with EffectsJatin Arora, Sam Westrick, Umut A. AcarPLDI 2023 · 6 次引用
- Functional Ownership through Fractional UniquenessDanielle Marshall, Dominic OrchardOOPSLA 2024 · 6 次引用
- Fully-Automatic Type Inference for Borrows with LifetimesWilliam Brandon, Benjamin Driscoll, Frank Dai, Jonathan Ragan-Kelley 等OOPSLA 2026
- Verus: Verifying Rust Programs using Linear Ghost TypesAndrea Lattuada, Travis Hance, Chanhee Cho, Matthias Brun 等OOPSLA 2023 · 86 次引用
