... | @@ -115,16 +115,12 @@ The renamer (`rnHsRecFields1`) supplies `Left sel_name` for the selector if it i |
... | @@ -115,16 +115,12 @@ The renamer (`rnHsRecFields1`) supplies `Left sel_name` for the selector if it i |
|
|
|
|
|
Typeclass and family instances are generated by `addLocalRecFldInsts` in `TcInstDecls`, regardless of whether or not the extension is enabled. This is called by `tcInstDecls1` to generate instances for fields from datatypes in the current group (at the same time as derived instances, from **deriving** clauses, are generated). The typeclass instances must be subsequently typechecked (by `tcInstDecls2`). Such instances are "private" in that they are available when typechecking the current module (in `tcg_inst_env`) but not exported to other modules (via `tcg_insts`). On the other hand, the underlying dfun ids and axioms are exported from the module as usual.
|
|
Typeclass and family instances are generated by `addLocalRecFldInsts` in `TcInstDecls`, regardless of whether or not the extension is enabled. This is called by `tcInstDecls1` to generate instances for fields from datatypes in the current group (at the same time as derived instances, from **deriving** clauses, are generated). The typeclass instances must be subsequently typechecked (by `tcInstDecls2`). Such instances are "private" in that they are available when typechecking the current module (in `tcg_inst_env`) but not exported to other modules (via `tcg_insts`). On the other hand, the underlying dfun ids and axioms are exported from the module as usual.
|
|
|
|
|
|
**AMG** This means that typeclass instances are not visible in GHCi, because it tracks only `tcg_insts` (via the `InteractiveContext`). What to do here? Perhaps a new field in `TcGblEnv` could record the private instances?
|
|
**AMG** This means that typeclass instances are not visible in GHCi, because it tracks only `tcg_insts` (via the `InteractiveContext`). I've added new fields in `TcGblEnv` to record the private instances, but there is still work to do here.
|
|
|
|
|
|
|
|
|
|
Moreover, `tcRnImports` calls `addImportedRecFldInsts` to add instances for overloaded record fields *that are in scope* from other modules. (This is different from the usual visible-everywhere story for instances.) We know which overloaded fields are in scope by looking at the `GlobalRdrEnv`. Since the dfuns and axioms are available, it is easy to turn them into appropriate `ClsInst`s and `FamInst`s.
|
|
Moreover, `tcRnImports` calls `addImportedRecFldInsts` to add instances for overloaded record fields *that are in scope* from other modules. (This is different from the usual visible-everywhere story for instances.) We know which overloaded fields are in scope by looking at the `GlobalRdrEnv`. Since the dfuns and axioms are available, it is easy to turn them into appropriate `ClsInst`s and `FamInst`s.
|
|
|
|
|
|
**AMG** This is the general idea, but there are some bugs left to iron out:
|
|
**AMG** When the extension is disabled, the instances are still generated and typechecked, and they must be in scope (via `addPrivateClsInsts`/`addPrivateTyFamInsts`) while they are being typechecked. This means `tcInstDecls1` and `2` need some refactoring.
|
|
|
|
|
|
- `tcIfaceGlobal` gives "not found" errors when compiling `TyCon.hs` for the stage 2 compiler. I think this might be something to do with the cycle with `Class.hs`.
|
|
|
|
- `addPrivateTyFamInsts` leads to fingerprinting errors, presumably because exporting an axiom without its family instance is not handled correctly.
|
|
|
|
- When the extension is disabled, the instances are still generated and typechecked, and they must be in scope (via `addPrivateClsInsts`/`addPrivateTyFamInsts`) while they are being typechecked. This means `tcInstDecls1` and `2` need some refactoring.
|
|
|
|
|
|
|
|
## Unused imports
|
|
## Unused imports
|
|
|
|
|
... | @@ -299,12 +295,14 @@ I've implemented the first option, adding a new warning `-fwarn-qualified-overlo |
... | @@ -299,12 +295,14 @@ I've implemented the first option, adding a new warning `-fwarn-qualified-overlo |
|
- With fundep in class, we don't need it in the instance.
|
|
- With fundep in class, we don't need it in the instance.
|
|
- Always mangle selector names (for simplicity)?
|
|
- Always mangle selector names (for simplicity)?
|
|
|
|
|
|
- Sort out impedance mismatch with boot files, if easy or enough people care
|
|
- Trouble with import/export
|
|
- Check import/export behaviour
|
|
- Trouble with deriving instances in GHC.Generics (makes up un-renamed syntax using field `RdrName`s)
|
|
|
|
- Sort out impedance mismatch with boot files
|
|
- Minimise contents of `AvailInfo` (preferably just a list of field `OccName`s): use `newGlobalBinder` to lookup cached mangled names for selectors and pieces
|
|
- Minimise contents of `AvailInfo` (preferably just a list of field `OccName`s): use `newGlobalBinder` to lookup cached mangled names for selectors and pieces
|
|
|
|
|
|
- Sort out reporting of unused imports.
|
|
- Sort out reporting of unused imports.
|
|
- Make instances available to GHCi.
|
|
- Make instances available to GHCi.
|
|
|
|
- Fix Haddock.
|
|
|
|
|
|
- Consider syntactic sugar for `Upd` constraints.
|
|
- Consider syntactic sugar for `Upd` constraints.
|
|
- Improve unsolved `Accessor p f` error message where `p` is something silly?
|
|
- Improve unsolved `Accessor p f` error message where `p` is something silly?
|
... | | ... | |