Gradual Liquid Type Inference

07/05/2018
by   Niki Vazou, et al.
0

Liquid typing provides a decidable refinement inference mechanism that is convenient but subject to two major issues: (1) inference is global and requires top-level annotations, making it unsuitable for inference of modular code components and prohibiting its applicability to library code, and (2) inference failure results in obscure error messages. These difficulties seriously hamper the migration of existing code to use refinements. This paper shows that gradual liquid type inference---a novel combination of liquid inference and gradual refinement types---addresses both issues. Gradual refinement types, which support imprecise predicates that are optimistically interpreted, can be used in argument positions to constrain liquid inference so that the global inference process e effectively infers modular specifications usable for library components. Dually, when gradual refinements appear as the result of inference, they signal an inconsistency in the use of static refinements. Because liquid refinements are drawn from a nite set of predicates, in gradual liquid type inference we can enumerate the safe concretizations of each imprecise refinement, i.e. the static refinements that justify why a program is gradually well-typed. This enumeration is useful for static liquid type error explanation, since the safe concretizations exhibit all the potential inconsistencies that lead to static type errors. We develop the theory of gradual liquid type inference and explore its pragmatics in the setting of Liquid Haskell.

READ FULL TEXT

page 1

page 2

page 3

page 4

research
12/08/2019

TypeWriter: Neural Type Prediction with Search-based Validation

Maintaining large code bases written in dynamically typed languages, suc...
research
10/15/2020

Refinement Types: A Tutorial

Refinement types enrich a language's type system with logical predicates...
research
05/25/2018

Spine-local Type Inference

We present spine-local type inference, a partial type inference system f...
research
08/28/2020

Effectiveness of Annotation-Based Static Type Inference

Benefits of static type systems are well-known: they offer guarantees th...
research
07/18/2023

Generative Type Inference for Python

Python is a popular dynamic programming language, evidenced by its ranki...
research
03/16/2023

TypeT5: Seq2seq Type Inference using Static Analysis

There has been growing interest in automatically predicting missing type...
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...

Please sign up or login with your details

Forgot password? Click here to reset