arXiv · 2103.06127
Linearly Qualified Types: Generic inference for capabilities and uniqueness
Abstract
A linear parameter must be consumed exactly once in the body of its function. When declaring resources such as file handles and manually managed memory as linear arguments, a linear type system can verify that these resources are used safely. However, writing code with explicit linear arguments requires bureaucracy. This paper presents linear constraints, a front-end feature for linear typing that decreases the bureaucracy of working with linear types. Linear constraints are implicit linear arguments that are filled in automatically by the compiler. We present linear constraints as a qualified type system,together with an inference algorithm which extends GHC's existing constraint solver algorithm. Soundness of linear constraints is ensured by the fact that they desugar into Linear Haskell.
Explore related subjects
Keep this discovery
Explore connections, maps & timelines
Arnaud Spiwack, Csongor Kiss, Jean-Philippe Bernardy, Nicolas Wu, Richard Eisenberg. 2021-03-10. Linearly Qualified Types: Generic inference for capabilities and uniqueness. https://doi.org/10.1145/3547626
Cite the original work for its findings. Save a collection to share your selection of sources.