Linear Haskell: practical linearity in a higher-order polymorphic language
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 introduce and 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 function types 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 program with linear types—we implemented our type system in a branch of GHC, the leading Haskell compiler, and demonstrate, with it, two kinds of applications of linear types: making functions, that otherwise would be considered to have side effects, pure; and enforcing protocols in I/O-performing functions.
Slides (LinearHaskellSlides.pdf) | 868KiB |
Wed 10 JanDisplayed time zone: Tijuana, Baja California change
10:30 - 12:10 | Types and EffectsResearch Papers at Watercourt Chair(s): Neel Krishnaswami Computer Laboratory, University of Cambridge | ||
10:30 25mTalk | Linear Haskell: practical linearity in a higher-order polymorphic language Research Papers Jean-Philippe Bernardy University of Gothenburg, Mathieu Boespflug Tweag I/O, Ryan R. Newton Indiana University, Simon Peyton Jones Microsoft Research, Arnaud Spiwack Tweag I/O Pre-print File Attached | ||
10:55 25mTalk | Polyadic Approximations, Fibrations and Intersection Types Research Papers | ||
11:20 25mTalk | Handling fibred algebraic effects Research Papers Danel Ahman Inria Paris | ||
11:45 25mTalk | Handle with Care: Relational Interpretation of Algebraic Effects and Handlers Research Papers Dariusz Biernacki University of Wrocław, Maciej Piróg University of Wrocław, Piotr Polesiuk University of Wrocław, Filip Sieczkowski University of Wrocław |