df67ac71
by Recursion Ninja at 2026-08-28T17:37:09-04:00
Resolving even more TTG related orphan type-class instances
Related to #21262 and #27469, both closed by 43dd2b15a2.
This commit addresses the technical debt remaining the end of the TTG project.
Orphan instances of data-types from within 'L.H.S' have been moved to either:
1. The module which defines the data-type
2. The module which defines the type-class;
i.e. moving an orphan 'Binary' instance to 'GHC.Utils.Binary'
The instances remaining after 43dd2b15a2 could not be relocated verbatim.
'GHC.Utils.Outputable' and 'GHC.Utils.Binary' sat below the AST in the import
graph, so a type-class module could see the 'GhcPass' type-family equations
that the instance bodies rely on.
A new module, 'GHC.Hs.Extension.Instances', collects the 'GhcPass'
instantiation of the Trees-that-Grow extension points previously declared in
'GHC.Hs.Extension.Pass', allowing more orphan type-class instance to be reolved.
Orphan instances resolved (82):
| Data-type | Resolved instance(s) | Former orphan module(s) |
| ------------------- | -------------------------------------- | ------------------------------ |
| BCOByteArray | Binary | GHC.ByteCode.Binary |
| BCONPtr | Binary | GHC.ByteCode.Binary |
| BCOPtr | Binary | GHC.ByteCode.Binary |
| ByteCodeHpcInfo | Binary | GHC.ByteCode.Binary |
| CompiledByteCode | Binary | GHC.ByteCode.Binary |
| UnlinkedBCO | Binary | GHC.ByteCode.Binary |
| BooleanFormula | Outputable | GHC.Data.BooleanFormula |
| HsLocalBindsLR | Outputable | GHC.Hs.Binds |
| RecordPatSynField | Outputable | GHC.Hs.Binds |
| ValBind | HasLoc | GHC.Hs.Binds |
| DerivClauseTys | Outputable | GHC.Hs.Decls |
| DocDecl | Outputable | GHC.Hs.Decls |
| FamilyInfo | Outputable | GHC.Hs.Decls |
| ForeignExport | Outputable | GHC.Hs.Decls |
| FunDep | Outputable | GHC.Hs.Decls |
| HsDecl | Outputable | GHC.Hs.Decls |
| InstDecl | Outputable | GHC.Hs.Decls |
| RoleAnnotDecl | Outputable | GHC.Hs.Decls |
| SpliceDecoration | Outputable | GHC.Hs.Decls |
| StandaloneKindSig | Outputable | GHC.Hs.Decls |
| TyClGroup | Outputable | GHC.Hs.Decls |
| WarnDecl | Outputable | GHC.Hs.Decls |
| HsDocString | Binary, Outputable, Show | GHC.Hs.DocString |
| ArithSeqInfo | Outputable | GHC.Hs.Expr |
| DotFieldOcc | Outputable | GHC.Hs.Expr |
| FieldLabelStrings | Outputable, OutputableBndr | GHC.Hs.Expr |
| HsArrowMatchContext | Outputable | GHC.Hs.Expr |
| HsLamVariant | Outputable | GHC.Hs.Expr |
| HsMatchContext | Outputable | GHC.Hs.Expr |
| Located | OutputableBndr | GHC.Hs.Expr |
| ParStmtBlock | Outputable | GHC.Hs.Expr |
| DataConCantHappen | Outputable | GHC.Hs.Extension |
| NoExtField | Outputable | GHC.Hs.Extension |
| IEWrappedName | Outputable, OutputableBndr, HasOccName | GHC.Hs.ImpExp |
| FractionalLit | Outputable, Show | GHC.Hs.Lit |
| HsLit | Outputable | GHC.Hs.Lit |
| HsQualLit | Outputable | GHC.Hs.Lit |
| IntegralLit | Outputable, Show | GHC.Hs.Lit |
| OverLitVal | Outputable | GHC.Hs.Lit |
| QualLitVal | Outputable | GHC.Hs.Lit |
| StringLiteral | Outputable, Show | GHC.Hs.Lit |
| HsFieldBind | Outputable | GHC.Hs.Pat |
| FieldOcc | Outputable, OutputableBndr | GHC.Hs.Type |
| GenLocated | OutputableBndr | GHC.Hs.Type |
| HsBndrVar | Outputable | GHC.Hs.Type |
| HsConDetails | Outputable | GHC.Hs.Type |
| HsContextDetails | Outputable | GHC.Hs.Type |
| HsForAllTelescope | Outputable | GHC.Hs.Type |
| HsIPName | Outputable, OutputableBndr | GHC.Hs.Type |
| HsPatSigType | Outputable | GHC.Hs.Type |
| HsTyPat | Outputable | GHC.Hs.Type |
| HsWildCardBndrs | Outputable | GHC.Hs.Type |
| LHsQTyVars | Outputable | GHC.Hs.Type |
| HsArg | Outputable, HasLoc | GHC.Hs.Type, GHC.Iface.Ext.Ast |
| DataDefnCons | HasLoc | GHC.Iface.Ext.Ast |
| HsDataDefn | HasLoc | GHC.Iface.Ext.Ast |
| CCallConv | Binary, Outputable | GHC.Types.ForeignCall |
| CCallTarget | Binary | GHC.Types.ForeignCall |
| CExportSpec | Binary, Outputable | GHC.Types.ForeignCall |
| CType | Binary | GHC.Types.ForeignCall |
| ForeignKind | Binary | GHC.Types.ForeignCall |
| Header | Binary, Outputable | GHC.Types.ForeignCall |
| Safety | Binary, Outputable | GHC.Types.ForeignCall |
| FieldLabel | NFData | GHC.Types.Name |
| InWarningCategory | Outputable | GHC.Unit.Module.Warnings |
| WarningCategory | Binary, Outputable | GHC.Unit.Module.Warnings |
Two instances for 'GhcPass' cannot have thier orphaned status resolved,
but were migrated to a "more defensible" home instead:
- 'WrapXRec' to 'GHC.Hs.Extension'
- 'BooleanFormulaDefault' to 'GHC.Hs.Extension.Instances'