... | ... | @@ -87,7 +87,7 @@ Foo.hs:15:10: error: [GHC-39999] |
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
```
|
|
|
|
|
|
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:
|
|
|
This is because when typechecking instances, GHC will only expand superclasses of a Given constraint if it is *Paterson-smaller* than the instance head. In this example, the `CanBeAliased (Op rep)` Given constraint is not Paterson-smaller than the instance head `RepTypes (Aliases rep)`, so GHC will not expand the superclasses of the Given constraint. For more information on what "Paterson-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
|
|
|
* [`Note [Recursive superclasses]`](https://gitlab.haskell.org/ghc/ghc/-/blob/fc02f3bbb5f47f880465e22999ba9794f658d8f6/compiler/GHC/Tc/TyCl/Instance.hs#L1501-1623) in the GHC source code (if you want a longer, more technical explanation)
|
... | ... | |