|
|
# Tying the knot
|
|
|
|
|
|
|
|
|
Background reading: [ GHC at The Architecture of Open Source Applications](http://www.aosabook.org/en/ghc.html) (search for "No Symbol Table").
|
|
|
Background reading: [GHC at The Architecture of Open Source Applications](http://www.aosabook.org/en/ghc.html) (search for "No Symbol Table").
|
|
|
|
|
|
|
|
|
Compilers usually have one or more data structures known as *symbol tables*, which are mappings from symbols to information about the symbol in question. GHC avoids symbol tables; instead, a symbol *contains* all information about itself. Thus, the data types for [Haskell entities](commentary/compiler/entity-types) (Id, TyVar, TyCon, DataCon, and Class) form an immutable cyclic data structure, where everything points to everything else. This makes it very convenient for the consumer, because there are accessor functions with simple types, such as `idType :: Id -> Type`.
|
... | ... | @@ -29,39 +29,39 @@ Use Keyword = `hs-boot` to ensure that a ticket ends up on these lists. |
|
|
|
|
|
**Open Tickets:**
|
|
|
|
|
|
<table><tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/1012">#1012</a></th>
|
|
|
<table><tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/1012">#1012</a></th>
|
|
|
<td>ghc panic with mutually recursive modules and template haskell</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/8441">#8441</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/8441">#8441</a></th>
|
|
|
<td>Allow family instances in an hs-boot file</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/9450">#9450</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/9450">#9450</a></th>
|
|
|
<td>GHC instantiates Data instances before checking hs-boot files</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/9562">#9562</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/9562">#9562</a></th>
|
|
|
<td>Type families + hs-boot files = unsafeCoerce</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/10333">#10333</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/10333">#10333</a></th>
|
|
|
<td>hs-boot modification doesn't induce recompilation</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/12034">#12034</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/12034">#12034</a></th>
|
|
|
<td>Template Haskell + hs-boot = Not in scope during type checking, but it passed the renamer</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/12063">#12063</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/12063">#12063</a></th>
|
|
|
<td>Knot-tying failure when type-synonym refers to non-existent data</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13069">#13069</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/13069">#13069</a></th>
|
|
|
<td>hs-boot files permit default methods in type class (but don't typecheck them)</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13180">#13180</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/13180">#13180</a></th>
|
|
|
<td>Confusing error when hs-boot abstract data implemented using synonym</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13299">#13299</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/13299">#13299</a></th>
|
|
|
<td>Typecheck multiple modules at the same time</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13322">#13322</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/13322">#13322</a></th>
|
|
|
<td>Pattern synonyms in hs-boot files</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13347">#13347</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/13347">#13347</a></th>
|
|
|
<td>Abstract classes in hs-boot should not be treated as injective</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13981">#13981</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/13981">#13981</a></th>
|
|
|
<td>Family instance consistency checks happens too early when hs-boot defined type occurs on LHS</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14092">#14092</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/14092">#14092</a></th>
|
|
|
<td>hs-boot unfolding visibility not consistent between --make and -c</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14103">#14103</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/14103">#14103</a></th>
|
|
|
<td>Retypechecking the loop in --make mode is super-linear when there are many .hs-boot modules</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14382">#14382</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/14382">#14382</a></th>
|
|
|
<td>The 'impossible' happened whilst installing gi-gtk via cabal</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/16127">#16127</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/16127">#16127</a></th>
|
|
|
<td>Panic: piResultTys1 in compiler/types/Type.hs:1022:5</td></tr></table>
|
|
|
|
|
|
|
... | ... | @@ -69,37 +69,37 @@ Use Keyword = `hs-boot` to ensure that a ticket ends up on these lists. |
|
|
|
|
|
**Closed Tickets:**
|
|
|
|
|
|
<table><tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/2412">#2412</a></th>
|
|
|
<table><tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/2412">#2412</a></th>
|
|
|
<td>Interaction between type synonyms and .hs-boot causes panic "tcIfaceGlobal (local): not found"</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/4003">#4003</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/4003">#4003</a></th>
|
|
|
<td>tcIfaceGlobal panic building HEAD with 6.12.2</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/7672">#7672</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/7672">#7672</a></th>
|
|
|
<td>boot file entities are sometimes invisible and are not (semantically) unified with corresponding entities in implementing module</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/10083">#10083</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/10083">#10083</a></th>
|
|
|
<td>ghc: panic! (the 'impossible' happened)</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/11062">#11062</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/11062">#11062</a></th>
|
|
|
<td>Type families + hs-boot files = panic (type family consistency check too early)</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/12035">#12035</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/12035">#12035</a></th>
|
|
|
<td>hs-boot knot tying insufficient for ghc --make</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/12042">#12042</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/12042">#12042</a></th>
|
|
|
<td>Infinite loop with type synonyms and hs-boot</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/12064">#12064</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/12064">#12064</a></th>
|
|
|
<td>tcIfaceGlobal error with existentially quantified types</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13140">#13140</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/13140">#13140</a></th>
|
|
|
<td>Handle subtyping relation for roles in Backpack</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13591">#13591</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/13591">#13591</a></th>
|
|
|
<td>"*** Exception: expectJust showModule" in ghci with hs-boot</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13710">#13710</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/13710">#13710</a></th>
|
|
|
<td>panic with boot and -jX</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/13803">#13803</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/13803">#13803</a></th>
|
|
|
<td>Panic while forcing the thunk for TyThing IsFile (regression)</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14075">#14075</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/14075">#14075</a></th>
|
|
|
<td>GHC panic with parallel make</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14080">#14080</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/14080">#14080</a></th>
|
|
|
<td>GHC panic while forcing the thunk for TyThing IsFile (regression)</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14396">#14396</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/14396">#14396</a></th>
|
|
|
<td>Hs-boot woes during family instance consistency checks</td></tr>
|
|
|
<tr><th><a href="https://gitlab.haskell.org//ghc/ghc/issues/14531">#14531</a></th>
|
|
|
<tr><th><a href="https://gitlab.haskell.org/ghc/ghc/issues/14531">#14531</a></th>
|
|
|
<td>tcIfaceGlobal (local): not found</td></tr></table>
|
|
|
|
|
|
|
... | ... | @@ -242,7 +242,7 @@ Like before, `T` and `S` form a mutually recursive loop; the difference is this |
|
|
However, this leads to a very intriguing requirement: when we typecheck the interface for `B.hi`, we must tie the knot with the local type environment (while typechecking.) Thus, rather than a mutable variable for the interface, we need to refer to a mutable variable for the current type-checking session. This variable is `tcg_type_env_var` in `TcGblEnv`. It is updated at various points during the typechecking session, including when we setup the type environment in `tcTyClDecls` (`tcExtendRecEnv` does the dirty work.)
|
|
|
|
|
|
|
|
|
This leads to another complication with `ghc --make`: just how we must retypecheck the interface files after we finish typechecking a module loop, we must also retypecheck the interface files BEFORE we start typechecking, so that the knot-tying can take place. Failure to do this lead to [\#12035](https://gitlab.haskell.org//ghc/ghc/issues/12035). (Actually, hypothetically you could remove the later retypecheck, but we need it so that we can get up-to-date unfoldings, which aren't computed until after we run the optimizer, which is after all the thunks have been forced.)
|
|
|
This leads to another complication with `ghc --make`: just how we must retypecheck the interface files after we finish typechecking a module loop, we must also retypecheck the interface files BEFORE we start typechecking, so that the knot-tying can take place. Failure to do this lead to [\#12035](https://gitlab.haskell.org/ghc/ghc/issues/12035). (Actually, hypothetically you could remove the later retypecheck, but we need it so that we can get up-to-date unfoldings, which aren't computed until after we run the optimizer, which is after all the thunks have been forced.)
|
|
|
|
|
|
## All of the bits and bobs
|
|
|
|
... | ... | |