A Modular Inference of Linear Types for Multiplicity-Annotated Arrows

11/01/2019
by   Kazutaka Matsuda, et al.
0

Bernardy et al. [2018] proposed a linear type system λ^q_→ as a core type system of Linear Haskell. In the system, the linearity is represented by multiplicity-annotated arrow types A →_m B, where m denotes the multiplicity of the argument of a function. Thanks to the representation, existing non-linear code typechecks without changes and newly written linear code can be used with the existing non-linear code for many cases. However, little is known for type inference for λ^q_→. Although Linear Haskell equips type inference, its algorithm has not been formalized and often fails to infer principal types, especially for higher-order functions. In this paper, based on OutsideIn(X) [Vytiniotis et al., 2011], we propose an inference system for a rank 1 qualified-typed variant of λ^q_→, which can infer principal types. A technical challenge is how to deal with ambiguous types inferred by naive qualified typing. We address the ambiguity issue by quantifier elimination and demonstrate the effectiveness of the approach by examples.

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
10/26/2017

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

Linear type systems have a long and storied history, but not a clear pat...
research
10/28/2020

Higher Order Linear Transformer

Following up on the linear transformer part of the article from Katharop...
research
08/14/2021

Data Type Inference for Logic Programming

In this paper we present a new static data type inference algorithm for ...
research
05/25/2018

Spine-local Type Inference

We present spine-local type inference, a partial type inference system f...
research
03/10/2021

Linear Constraints

A linear argument must be consumed exactly once in the body of its funct...
research
11/12/2019

Kind Inference for Datatypes: Technical Supplement

In recent years, languages like Haskell have seen a dramatic surge of ne...

Please sign up or login with your details

Forgot password? Click here to reset