Gradual liquid type inference

Abstract : Refinement types allow for lightweight program verification by enriching types with logical predicates. 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 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 finite set of predicates, in gradual liquid type inference we can enumerate the textitsafe 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. To demonstrate the utility of our approach, we develop an interactive tool, GuiLT, for gradual liquid type inference in Liquid Haskell that both infers modular types and explores safe concretizations of gradual refinements. We report on the use of GuiLT for error reporting and discuss a case study on the migration of three commonly-used Haskell list manipulation libraries into Liquid Haskell.
Type de document :
Article dans une revue
Proceedings of the ACM on Programming Languages, ACM, 2018, 2 (OOPSLA), pp.1-25. 〈10.1145/3276502〉
Liste complète des métadonnées
Contributeur : Cătălin Hriţcu <>
Soumis le : dimanche 9 décembre 2018 - 20:03:02
Dernière modification le : mercredi 27 février 2019 - 15:20:01


Distributed under a Creative Commons Paternité 4.0 International License

Lien texte intégral




Niki Vazou, Éric Tanter, David Van Horn. Gradual liquid type inference. Proceedings of the ACM on Programming Languages, ACM, 2018, 2 (OOPSLA), pp.1-25. 〈10.1145/3276502〉. 〈hal-01949207〉



Consultations de la notice