Linear Haskell: practical linearity in a higher-order polymorphic language

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.
Document type :
Journal articles
Liste complète des métadonnées

Cited literature [34 references]  Display  Hide  Download

https://hal.archives-ouvertes.fr/hal-01673536
Contributor : Arnaud Spiwack <>
Submitted on : Saturday, December 30, 2017 - 2:35:22 PM
Last modification on : Friday, January 4, 2019 - 5:33:38 PM

File

Linear Haskell practical linea...
Files produced by the author(s)

Identifiers

Collections

Citation

Jean-Philippe Bernardy, Mathieu Boespflug, Ryan R. Newton, Simon Peyton Jones, Arnaud Spiwack. Linear Haskell: practical linearity in a higher-order polymorphic language. Proceedings of the ACM on Programming Languages, ACM, 2017, 2 (POPL), pp.1-29. ⟨10.1145/3158093⟩. ⟨hal-01673536⟩

Share

Metrics

Record views

160

Files downloads

314