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