... | ... | @@ -87,7 +87,7 @@ Foo.hs:15:10: error: [GHC-39999] |
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
```
|
|
|
|
|
|
This is because when typechecking instances, GHC will only expand superclasses of Given constraints if it is *Patterson-smaller* than the instance head. In this example, the `CanBeAliased (Op rep)` Given constraint is not Patterson-smaller than the instance head `RepTypes (Aliases rep)`, so GHC will not expand the superclasses of the Given constraint. For more information on what "Patterson-smaller" means, refer to the [Undecidable instances and loopy superclasses](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/instances.html?highlight=overlapping%20instance#undecidable-instances-and-loopy-superclasses) section of the GHC User's Guide.
|
|
|
This is because when typechecking instances, GHC will only expand superclasses of a Given constraint if it is *Patterson-smaller* than the instance head. In this example, the `CanBeAliased (Op rep)` Given constraint is not Patterson-smaller than the instance head `RepTypes (Aliases rep)`, so GHC will not expand the superclasses of the Given constraint. For more information on what "Patterson-smaller" means, refer to the [Undecidable instances and loopy superclasses](https://ghc.gitlab.haskell.org/ghc/doc/users_guide/exts/instances.html?highlight=overlapping%20instance#undecidable-instances-and-loopy-superclasses) section of the GHC User's Guide.
|
|
|
|
|
|
To repair the instance above, one can simply add `Show (OpWithAliases (Op rep))` to the instance context like so:
|
|
|
|
... | ... | |