Linear Types: ready for review
Spiwack, Arnaud
arnaud.spiwack at tweag.io
Fri May 3 09:52:09 UTC 2019
Dear GHC devs,
The linear types patch is ready for review!
https://gitlab.haskell.org/ghc/ghc/merge_requests/852
It is a fairly large patch (~3500loc of change to the compiler itself,
with a ~2000loc diff on the testsuite). And it's gone through a lot of
redesigns. The issue with a patch like this is that it is rather easy
to get reviewer fatigue and just let things through.
This is why I want to encourage as many people as possible to give a
thorough review of part of the patch. Even 15 minutes of your time
would be tremendously helpful!
Here is what I suggest: pick a part of the compiler you know well, and
look at how the patch affects it. If there is something that you don't
understand let us know! Either in the MR discussion, or send an email
to Krzysztof and me. We will answer and update the documentation.
---
If you are still unsure where to start, here are what we consider to
be the main entry points to the patch:
- The file Multiplicity, which defines type Mult = Type, the Scaled
type and functions unrestricted, linear, pattern synonyms One and
Omega, quick submultiplicity test submult
- The change to FunTy and new mkFunTy in TyCoRep, where the
multiplicity argument is added
- The change to funTyCon in TysPrim
- The new unrestrictedFunTyCon and multiplicityTy in TysWiredIn
- Var has now a new field varMult; functions such as
updateVarTypeAndMult can be used to update multiplicity (e.g. when
zonking). In Core, the multiplicity of a lambda is indicated by its
varMult; multiplicity of a case expression is indicated by varMult
of the case binder.
- The functions mkDataConRepXin basicTypes/MkId and and
dataConUserType function in basicTypes/DataCon, which are adding
multiplicity variables to constructors. The change to wrapper_reqd
means that all data constructors have a wrapper now.
- The file UsageEnv defines a map from a variable to its multiplicity,
used when typechecking
- Calls to submult and tcSubMult, which guide multiplicity checking in
the type checker
- ensureSubMult and its calls, which guide multiplicity checking in
Lint
---
A more in-depth documentation and overview of the patch is on the
wiki: https://gitlab.haskell.org/ghc/ghc/wikis/linear-types/implementation
It has a table of contents which you can use as yet another way to
find a starting point.
---
If any of these resources are lacking, let us know too! We'll make
sure to update them.
---
Finally, I'll be holding a project session on Linear Types in ZüriHac
next month. Where we can have further, more in-depth discussion about
the patch, finalise its documentation, and address outstanding
requests from reviews.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20190503/669a0f94/attachment.html>
More information about the ghc-devs
mailing list