summaryrefslogtreecommitdiff
path: root/compiler/cbits
diff options
context:
space:
mode:
authorRyan Scott <ryan.gl.scott@gmail.com>2022-03-06 18:34:33 -0500
committerRyan Scott <ryan.gl.scott@gmail.com>2022-03-07 06:13:15 -0500
commitfffc369cd7ac5faceb137db9cb63333b0ec116ab (patch)
treede5c86cf58982b2cb113685e6025034e0123517d /compiler/cbits
parent706deee0524ca6af26c8b8d5cff17a6e401a2c18 (diff)
downloadhaskell-wip/T21185.tar.gz
Delete GenericKind_ in favor of GenericKind_DCwip/T21185
When deriving a `Generic1` instance, we need to know what the last type variable of a data type is. Previously, there were two mechanisms to determine this information: * `GenericKind_`, where `Gen1_` stored the last type variable of a data type constructor (i.e., the `tyConTyVars`). * `GenericKind_DC`, where `Gen1_DC` stored the last universally quantified type variable in a data constructor (i.e., the `dataConUnivTyVars`). These had different use cases, as `GenericKind_` was used for generating `Rep(1)` instances, while `GenericKind_DC` was used for generating `from(1)` and `to(1)` implementations. This was already a bit confusing, but things went from confusing to outright wrong after !6976. This is because after !6976, the `deriving` machinery stopped using `tyConTyVars` in favor of `dataConUnivTyVars`. Well, everywhere with the sole exception of `GenericKind_`, which still continued to use `tyConTyVars`. This lead to disaster when deriving a `Generic1` instance for a GADT family instance, as the `tyConTyVars` do not match the `dataConUnivTyVars`. (See #21185.) The fix is to stop using `GenericKind_` and replace it with `GenericKind_DC`. For the most part, this proves relatively straightforward. Some highlights: * The `forgetArgVar` function was deleted entirely, as it no longer proved necessary after `GenericKind_`'s demise. * The substitution that maps from the last type variable to `Any` (see `Note [Generating a correctly typed Rep instance]`) had to be moved from `tc_mkRepTy` to `tc_mkRepFamInsts`, as `tc_mkRepTy` no longer has access to the last type variable. Fixes #21185.
Diffstat (limited to 'compiler/cbits')
0 files changed, 0 insertions, 0 deletions