Three core developers from the Haskell linear types team are on this show: Arnaud Spiwack, Richard Eisenberg and Krzysztof Gogolewski. They have conceived, reviewed and implemented the Haskell linear types extension that is shipped with the latest compiler version. Linear types allow to express that a function uses an argument exactly once in its type signature which opens all kinds of possibilities.
In this episode, Arnaud, Richard and Krzysztof give a short introduction to linear types and then answer community questions that have been asked on reddit. The questions that are answered are outlined below. Links and further material are available on the episode website on compositional.fm/linear-types-ama .
Thank you for contributing the questions and happy listening!
[00 : 12 : 40] Will using linear types throughout my program improve performance?
[00 : 16 : 14] If I see a function with linear type in it's type signature, what kinds of things might it tell me about the purpose or use cases for that function?
[00 : 20 : 51] How might LinearTypes pave the way for an alternative to conduit,pipes, and other streaming IO libraries?
[00 : 23 : 31] Are linear types inferable with the Hindley-Milner algorithm?
[00 : 24 : 54] Are the current boxed linear containers the first step or all that is planned for now?
[00 : 26 : 31] Are nested linear containers possible?
[00 : 30 : 37] There were plans for a safe coerce-style freezing api, does that still seem workable?
[00 : 31 : 44] What is the state of the linear case/let/if/where mechanism?
[00 : 35 : 15] Are there any thoughts about ressource guarantees or RAII types in some far utopian future?
[00 : 41 : 17] How do the Haskell linear types compare to the Rust equivalent?
[00 : 48 : 02] What are the scenarios where the use of linear types makes a lot of sense?
[00 : 51 : 19] Will we get linear functions taking and returning a state token that can effectively replace IO?
[00 : 59 : 10] What benefit will linear types bring to a garbage collected language like Haskell?
[01 : 02 : 13] Is an automatic "C-like" memory management separate from Haskell's garbage collector on the linear types roadmap?
[01 : 02 : 58] Could strictness analysis results be used to suggest extra linear arrows with an optional warning?
[01 : 04 : 04] What are limitations and recommendations concerning migration of existing code?
[01 : 04 : 58] To what extent can a package mix code that uses linear types with code that does not use linear types?
[01 : 07 : 50] What is the recommended practice for migrating existing libraries to use linear types?
- Call for community questions on reddit
- The original paper that outlined how linear types could be implemented in Haskell
- The linear-types GHC proposal
- All Tweag linear types blog posts
- linear base - a standard library for developing applications with linear types
- [00 : 15 : 30] GHC ticket about using linear types
- [00 : 18 : 40] Parametricity theorems and linear logic
- [00 : 33 : 00] GHC ticket about linear types and rebindable if then else
- [00 : 34 : 00] Workaround for linear case in 9.0
- [00 : 34 : 20] GHC ticket about linear let
- [00 : 46 : 30] Blog post about destination passing style
- [00 : 53 : 20] Critique of the IO Monad explanation 1
- [00 : 53 : 20] Critique of the IO Monad explanation 2