[ghc-steering-committee] Linear types (#111): conditional acceptance

Richard Eisenberg rae at cs.brynmawr.edu
Thu Oct 11 21:45:36 UTC 2018


Hi all,

Several members of the steering committee met at ICFP to discuss the Linear Types proposal, #111. While some concerns were raised about the utility of the proposed approach (as also explained on the GitHub trail), the committee agreed that the best way forward would be to accept the proposal.

I thus propose *conditional acceptance*, subject to these conditions, which were discussed at ICFP:

1. Error messages must remain free of mention of linear types, unless -XLinearTypes is in effect (or some flag like -fprint-linear-types is on). The same must be true of using the `:type` facility in GHCi.

2. Type inference must remain backward-compatible. All programs accepted today must be accepted when -XLinearTypes is not in effect. Ideally, these programs would also be accepted when -XLinearTypes is in effect, but there can be some wiggle room here.

3. Compile times for programs without -XLinearTypes must not unduly increase. Anything approaching or over a 2% across-the-board increase in compile times would be a cause for concern.

4. There must be no degradation in runtime performance of GHC-compiled programs. Linear types in Core might, for example, make some optimizations harder to apply; however, we must find a way to get runtime performance on par with what we have today.

5. There must be a story for a migration of `base`. The committee is concerned that, once linear types hits, there will be a great demand to incorporate linear types into `base`. (Note that `fmap` may want a linear type, and due to Functor's status as a superclass of Monad, `fmap` is really baked in.) How will this work? In particular, how will Haddock render newly-linearized types?

6. The theory of the linear types must be sound. This seems to be the case today, but as things evolve, we want to state explicitly that this must remain true. In particular, we must be able to rely on the safety of using linear mutable arrays.

7. There must be a specification (in some typeset document) of the new core language, written out for public inspection.

If the final version of this should violate these prescriptions, it does not immediately mean we are at an impasse -- it just means that we need to have more discussion.

Before officially posting this on #111 on behalf of the committee, I'd like some feedback on this recommendation. As usual, I'll take silence for agreement.

Discussion period: 1 week (shortened due to the fact that many have already participated in formulating this list)

Thanks!
Richard


More information about the ghc-steering-committee mailing list