Affiliation:
1. University of Gothenburg, Sweden
2. Tweag I/O, France
3. Indiana University, USA
4. Microsoft Research, UK
Abstract
Linear type systems have a long and storied history, but not a clear path forward to integrate with existing languages such as OCaml or Haskell. In this paper, we study a linear type system designed with two crucial properties in mind: backwards-compatibility and code reuse across linear and non-linear users of a library. Only then can the benefits of linear types permeate conventional functional programming. Rather than bifurcate types into linear and non-linear counterparts, we instead attach linearity to
function arrows
. Linear functions can receive inputs from linearly-bound values, but can
also
operate over unrestricted, regular values.
To demonstrate the efficacy of our linear type system — both how easy it can be integrated in an existing language implementation and how streamlined it makes it to write programs with linear types — we implemented our type system in ghc, the leading Haskell compiler, and demonstrate two kinds of applications of linear types: mutable data with pure interfaces; and enforcing protocols in I/O-performing functions.
Funder
Vetenskapsrådet
European Research Council
Publisher
Association for Computing Machinery (ACM)
Subject
Safety, Risk, Reliability and Quality,Software
Reference36 articles.
1. Monads Need Not Be Endofunctors
2. Cogent
3. Logic Programming with Focusing Proofs in Linear Logic
4. Robert Atkey. 2017. The Syntax and Semantics of Quantitative Type Theory. (2017). Under submission. Robert Atkey. 2017. The Syntax and Semantics of Quantitative Type Theory. (2017). Under submission.
5. Uniqueness typing for functional languages with graph rewriting semantics
Cited by
72 articles.
订阅此论文施引文献
订阅此论文施引文献,注册后可以免费订阅5篇论文的施引文献,订阅后可以查看论文全部施引文献
1. Coeffects for MiniJava: Cf-Mj;Proceedings of the 26th ACM International Workshop on Formal Techniques for Java-like Programs;2024-09-20
2. Oxidizing OCaml with Modal Memory Management;Proceedings of the ACM on Programming Languages;2024-08-15
3. Functional Ownership through Fractional Uniqueness;Proceedings of the ACM on Programming Languages;2024-04-29
4. Linear Contextual Metaprogramming and Session Types;Electronic Proceedings in Theoretical Computer Science;2024-04-06
5. Soundly Handling Linearity;Proceedings of the ACM on Programming Languages;2024-01-05