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

10/26/2017
by   Jean-Philippe Bernardy, et al.
0

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.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
11/01/2019

Modular Inference of Linear Types for Multiplicity-Annotated Arrows

Bernardy et al. [2018] proposed a linear type system λ^q_→ as a core typ...
research
11/01/2019

A Modular Inference of Linear Types for Multiplicity-Annotated Arrows

Bernardy et al. [2018] proposed a linear type system λ^q_→ as a core typ...
research
06/22/2019

Mixed Linear and Non-linear Recursive Types

We describe a type system with mixed linear and non-linear recursive typ...
research
06/22/2019

LNL-FPC: The Linear/Non-linear Fixpoint Calculus

We describe a type system with mixed linear and non-linear recursive typ...
research
03/08/2023

Alice or Bob?: Process Polymorphism in Choreographies

We present PolyChorλ, a language for higher-order functional choreograph...
research
05/04/2021

Solo: Enforcing Differential Privacy Without Fancy Types

All current approaches for statically enforcing differential privacy in ...
research
12/18/2015

The interface for functions in the dune-functions module

The dune-functions dune module introduces a new programmer interface for...

Please sign up or login with your details

Forgot password? Click here to reset