diff options
author | Sebastian Graf <sebastian.graf@kit.edu> | 2019-10-25 11:20:48 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2019-10-28 09:22:35 -0400 |
commit | e951f219597a3e8209abd62f85c717865f7445ca (patch) | |
tree | f1036c6a31758fb835179fc147ab4830c0b61c20 /compiler/GHC/Hs/Extension.hs | |
parent | e0e0485634d9a047b43da958c09e3bf6c5937c0f (diff) | |
download | haskell-e951f219597a3e8209abd62f85c717865f7445ca.tar.gz |
Use FlexibleInstances for `Outputable (* p)` instead of match-all instances with equality constraints
In #17304, Richard and Simon dicovered that using `-XFlexibleInstances`
for `Outputable` instances of AST data types means users can provide orphan
`Outputable` instances for passes other than `GhcPass`.
Type inference doesn't currently to suffer, and Richard gave an example
in #17304 that shows how rare a case would be where the slightly worse
type inference would matter.
So I went ahead with the refactoring, attempting to fix #17304.
Diffstat (limited to 'compiler/GHC/Hs/Extension.hs')
-rw-r--r-- | compiler/GHC/Hs/Extension.hs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/compiler/GHC/Hs/Extension.hs b/compiler/GHC/Hs/Extension.hs index 35afc5f8d3..b73855eb7a 100644 --- a/compiler/GHC/Hs/Extension.hs +++ b/compiler/GHC/Hs/Extension.hs @@ -1162,13 +1162,13 @@ type OutputableX p = -- See Note [OutputableX] -- ---------------------------------------------------------------------- -- |Constraint type to bundle up the requirement for 'OutputableBndr' on both --- the @id@ and the 'NameOrRdrName' type for it -type OutputableBndrId id = - ( OutputableBndr (NameOrRdrName (IdP id)) - , OutputableBndr (IdP id) - , OutputableBndr (NameOrRdrName (IdP (NoGhcTc id))) - , OutputableBndr (IdP (NoGhcTc id)) - , NoGhcTc id ~ NoGhcTc (NoGhcTc id) - , OutputableX id - , OutputableX (NoGhcTc id) +-- the @p@ and the 'NameOrRdrName' type for it +type OutputableBndrId pass = + ( OutputableBndr (NameOrRdrName (IdP (GhcPass pass))) + , OutputableBndr (IdP (GhcPass pass)) + , OutputableBndr (NameOrRdrName (IdP (NoGhcTc (GhcPass pass)))) + , OutputableBndr (IdP (NoGhcTc (GhcPass pass))) + , NoGhcTc (GhcPass pass) ~ NoGhcTc (NoGhcTc (GhcPass pass)) + , OutputableX (GhcPass pass) + , OutputableX (NoGhcTc (GhcPass pass)) ) |