Skip to content

Move types from GHC.Types.Basic to proper L.H.S locations

Hassan Al-Awwadi requested to merge wip/ttg/types/basic into master

GHC.Types.Basic has a few types that rightfully belong in L.H.S. For one, and it has some types that are currently imported but should really be moved to extension points.

import GHC.Types.Basic (TopLevelFlag, OverlapMode, RuleName, Activation -- in decls
                       ,TyConFlavour(..), TypeOrData(..))
import GHC.Types.Basic ( RecFlag(..), TypeOrKind(..) )                  -- in bind

And though its not explicitly in the import list InlinePragma also has the essence of something that should belong to L.H.S.

For now we have the following changes:

  • RuleName is just a synonym for FastString, since FastString is already imported in L.H.S.Basic, its definition has been moved there
  • TopLevelFlag has been moved to the extension point of FamilyDecl, so it no longer needs to be imported
  • OverlapMode has been moved to L.H.S.OverlapPragma and parameterized over the pass.
    • All instances of SourceText, used for exact printing by GHC, have been moved to extension fields.
    • NonCanonical has been moved to an extension constructor
  • InlinePragma has been moved to L.H.S.InlinePragma and parameterized over the field
    • As have Activation and InlineSpec which it relies upon.
    • All instances of SouceText have been moved to extension fields

I'm sure there will be plenty of feedback to be resolved since this change came with plenty of churn and people might want me to resolve things differently, but at least the edges have been cut now. Probably should have been three separate merge requests, but alas.

Edited by Hassan Al-Awwadi

Merge request reports