Decoupling Language.Haskell.Syntax.Binds from GHC.Types.Basic
This MR addresses issue #26670 (closed) by decoupling Language.Haskell.Syntax.Binds from GHC.Types.Basic.
This is achieved by transferring the InlinePragma data-type and its related sub-types from GHC.Types.Basic to a new module Language.Haskell.Syntax.Binds.InlinePragma.
Changes
-
A new module
GHC.Types.Arityis added to export arity related type synonyms to the importing module without forming an module import loop. The arity type synonyms are transfered fromGHC.Types.Basic. -
Another new module
GHC.Types.InlinePragmais added to define GHC-specific definitions related toInlinePragmaand re-export definitions fromLanguage.Haskell.Syntax.Binds.InlinePragmaindependently of theGHC.Types.Basicmodule. TheGHC.Types.Basicmodule is a "dumping ground" of many types in GHC and consequently it has become a troublesome entanglement that causes module import loops. By paring off theInlinePragmadefinitions into their own module, we avoid several module import loops while simultaneously reducing the entangling nature ofGHC.Types.Basic, since many data-types are now defined outside the that module. -
Many GHC modules no longer depend on the "dumping ground"
GHC.Types.Basicmodules, and instead depend on eitherGHC.Types.ArityorGHC.Types.InlinePragma -
The following data-types are moved from
GHC.Types.BasictoLanguage.Haskell.Syntax.Binds.InlinePragma:InlinePragmaInlineSpecRuleMatchInfoActivationPhaseNum
-
The following data-types are moved from
GHC.Types.BasictoGHC.Types.InlinePragma:CompilerPhase
-
The following data-types are exported from
GHC.Types.InlinePragma:InlinePragmaInlineSpecRuleMatchInfoActivationPhaseNumCompilerPhase
-
The
InlineSpecdata-type has been simplified to no longer store aSourceTextvalue. It was determined that theSourceTextvalue of theInlineSpecwas always identical to theSourceTextvalue contain in the parentInlinePragmadata-type. The removal of redundant storage simplifies the AST syntax and marginally reduces memory usage. -
Added a new record
InlinePragmaGhcTagto track theSourceTextandArityof the function duringGhcRnandGhcTcpasses. -
The instances of
Binaryfor these data-types are moved toGHC.Utils.Binary(no orphans):InlineSpecRuleMatchInfoActivation
-
The instances of
Binaryfor these data-types are moved toGHC.Types.InlinePragma(sadly orphans):InlinePragmaCompilerPhase
-
The instances of
Outputablefor these data-types are moved toGHC.Utils.Outputable(no orphans):InlinePragmaInlineSpecRuleMatchInfoActivation
-
The instances of
Outputablefor these data-types are moved toGHC.Types.InlinePragma(sadly orphans):CompilerPhase
Note: The orphan Binary andOutputable instances exist due to cyclic imports, and cannot be migrated to GHC.Utils.{Binary,Outputable} until the dependency on GHC.Hs.Doc and GHC.Types.Basic are removed from several GHC modules.