Linear Haskell: practical linearity in a higher-order polymorphic language
Jean-Philippe Bernardy, Mathieu Boespflug, Ryan R. Newton, Simon, Peyton Jones, Arnaud Spiwack

TL;DR
This paper introduces a practical linear type system for Haskell that maintains backwards compatibility and facilitates code reuse, enabling safer mutable data and protocol enforcement in I/O functions.
Contribution
It presents a linear type system integrated into GHC that attaches linearity to function arrows, allowing seamless use of linear and non-linear code.
Findings
Linear types can be integrated into GHC with minimal changes.
Linear types enable safe mutable data with pure interfaces.
Protocols in I/O functions can be enforced using linear types.
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…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsLogic, programming, and type systems · Advanced Database Systems and Queries · Parallel Computing and Optimization Techniques
