recursion-ninja pushed to branch wip/TTG-No-Orphans at Glasgow Haskell Compiler / GHC Commits: 22ac455a by Recursion Ninja at 2026-07-03T09:23:24-04:00 Fourth pass of orphan instance removal. This is part of a technical debt removal effort made possible now that separating out the AST via TTG comes to a close. In order to resolve a few more orphan instances, 'GHC.Utils.Outputable' needs the 'IsPass' and 'ghcPass' definitions to be in scope when importing 'GHC.Hs.Extension.GhcPass'. These are currently defined in 'GHC.Hs.Extension', but it is trivial to perform the migration. The 'GHC.Hs.Specificity' module only defines the 'NFData' 'Specificity' orphan instance. The definition was moved into the 'L.H.S' "namespace" and the superfluous module has been removed. Orphan instances resolved: | Data-type | Type-class Instance(s) | Old Orphan Module | | ----------------- | ---------------------------- | ------------------ | | DataConCantHappen | Outputable DataConCantHappen | GHC.Hs.Extension | | NoExtField | Outputable NoExtField | GHC.Hs.Extension | | Specificity | NFData Specificity | GHC.Hs.Specificity | - - - - - 5a2086be by Recursion Ninja at 2026-07-03T09:23:28-04:00 Fifth and final pass of orphan instance removal. This is part of a technical debt removal effort made possible now that separating out the AST via TTG comes to a close. Revised all module headers containing the '{-# OPTIONS_GHC -Wno-orphans #-}' pragma; updating the remaining orphan instance lists for accuracy and standardizing the documentation format across modules. Slightly more verbose in some modules, but worth it for standardization and clarity of the remaining instances. - - - - - 16 changed files: - compiler/GHC/Core/Coercion/Axiom.hs - compiler/GHC/Core/DataCon.hs - compiler/GHC/Hs/Decls.hs - compiler/GHC/Hs/Doc.hs - compiler/GHC/Hs/DocString.hs - compiler/GHC/Hs/Extension.hs - compiler/GHC/Hs/Extension/GhcPass.hs - compiler/GHC/Hs/ImpExp.hs - − compiler/GHC/Hs/Specificity.hs - compiler/GHC/Hs/Type.hs - compiler/GHC/Types/Hint/Ppr.hs - compiler/GHC/Types/InlinePragma.hs - compiler/GHC/Types/Var.hs - compiler/GHC/Utils/Outputable.hs - compiler/Language/Haskell/Syntax/Specificity.hs - compiler/ghc.cabal.in Changes: ===================================== compiler/GHC/Core/Coercion/Axiom.hs ===================================== @@ -1,4 +1,9 @@ -{-# OPTIONS_GHC -Wno-orphans #-} -- NFData Role +{-# OPTIONS_GHC -Wno-orphans #-} +{- +Suppression of warnings are required for +the type-class instance(s): + - NFData Role +-} -- (c) The University of Glasgow 2012 ===================================== compiler/GHC/Core/DataCon.hs ===================================== @@ -5,7 +5,13 @@ \section[DataCon]{@DataCon@: Data Constructors} -} -{-# OPTIONS_GHC -Wno-orphans #-} -- NFData +{-# OPTIONS_GHC -Wno-orphans #-} +{- +Suppression of warnings are required for +the type-class instance(s): + - NFData SrcStrictness + - NFData SrcUnpackedness +-} module GHC.Core.DataCon ( -- * Main data types ===================================== compiler/GHC/Hs/Decls.hs ===================================== @@ -2,7 +2,44 @@ {-# LANGUAGE UndecidableInstances #-} -- Wrinkle in Note [Trees That Grow] -- in module Language.Haskell.Syntax.Extension -{-# OPTIONS_GHC -Wno-orphans #-} -- Outputable +{-# OPTIONS_GHC -Wno-orphans #-} +{- +Suppression of warnings are required for +the type-class instance(s): + - Outputable (AnnDecl (GhcPass p)) + - Outputable (ClsInstDecl (GhcPass p)) + - Outputable (ConDecl (GhcPass p)) + - Outputable (DataFamInstDecl (GhcPass p)) + - Outputable (DefaultDecl (GhcPass p)) + - Outputable (DerivClauseTys (GhcPass p)) + - Outputable (DerivDecl (GhcPass p)) + - Outputable (DerivStrategy (GhcPass p)) + - Outputable (FamilyDecl (GhcPass p)) + - Outputable (FamilyInfo pass) + - Outputable (ForeignDecl (GhcPass p)) + - Outputable (ForeignExport (GhcPass p)) + - Outputable (ForeignImport (GhcPass p)) + - Outputable (FunDep (GhcPass p)) + - Outputable (HsDataDefn (GhcPass p)) + - Outputable (HsDecl (GhcPass p)) + - Outputable (HsDerivingClause (GhcPass p)) + - Outputable (HsGroup (GhcPass p)) + - Outputable (InstDecl (GhcPass p)) + - Outputable (RoleAnnotDecl (GhcPass p)) + - Outputable (RuleDecl (GhcPass p)) + - Outputable (RuleDecls (GhcPass p)) + - Outputable (SpliceDecl (GhcPass p)) + - Outputable SpliceDecoration + - Outputable (StandaloneKindSig (GhcPass p)) + - Outputable (TyClDecl (GhcPass p)) + - Outputable (TyClGroup (GhcPass p)) + - Outputable (TyFamInstDecl (GhcPass p)) + - Outputable (WarnDecl (GhcPass p)) + - Outputable (WarnDecls (GhcPass p)) +and type-family instance(s): + - Anno + - X*/XX* extension points (over 50) for data-types defined in 'Language.Haskell.Syntax.Decls' +-} {- (c) The University of Glasgow 2006 ===================================== compiler/GHC/Hs/Doc.hs ===================================== @@ -4,6 +4,16 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -Wno-orphans #-} +{- +Suppression of warnings are required for +the type-class instance(s): + - Binary (WithHsDocIdentifiers a GhcRn) + - Data (WithHsDocIdentifiers a pass) + - Eq (WithHsDocIdentifiers a pass) + - NFData (WithHsDocIdentifiers a pass) +and type-family instance(s): + - Anno +-} module GHC.Hs.Doc ( HsDoc ===================================== compiler/GHC/Hs/DocString.hs ===================================== @@ -4,7 +4,15 @@ {-# LANGUAGE StandaloneDeriving #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} -{-# OPTIONS_GHC -Wno-orphans #-} -- Data, Eq, Show, NFData +{-# OPTIONS_GHC -Wno-orphans #-} +{- +Suppression of warnings are required for +the type-class instance(s): + - Data (HsDocString pass) + - Eq (HsDocString pass) + - NFData (HsDocString (GhcPass p)) + - Show (HsDocString pass) +-} module GHC.Hs.DocString ( LHsDocString ===================================== compiler/GHC/Hs/Extension.hs ===================================== @@ -1,10 +1,16 @@ {-# LANGUAGE AllowAmbiguousTypes #-} -- for pprIfTc, etc. {-# LANGUAGE TypeFamilyDependencies #-} -{-# LANGUAGE UndecidableSuperClasses #-} -- for IsPass; see Note [NoGhcTc] {-# LANGUAGE UndecidableInstances #-} -- Wrinkle in Note [Trees That Grow] -- in module Language.Haskell.Syntax.Extension -{-# OPTIONS_GHC -Wno-orphans #-} -- Outputable +{-# OPTIONS_GHC -Wno-orphans #-} +{- +Suppression of warnings are required for +the type-family instance(s): + - Anno + - IdP + - IdOccP +-} module GHC.Hs.Extension ( module GHC.Hs.Extension @@ -24,68 +30,6 @@ import GHC.Types.Var import GHC.Utils.Outputable hiding ((<>)) import GHC.Parser.Annotation -{- -Note [IsPass] -~~~~~~~~~~~~~ -One challenge with the Trees That Grow approach -is that we sometimes have different information in different passes. -For example, we have - - type instance XViaStrategy GhcPs = LHsSigType GhcPs - type instance XViaStrategy GhcRn = LHsSigType GhcRn - type instance XViaStrategy GhcTc = Type - -This means that printing a DerivStrategy (which contains an XViaStrategy) -might need to print a LHsSigType, or it might need to print a type. Yet we -want one Outputable instance for a DerivStrategy, instead of one per pass. We -could have a large constraint, including e.g. (Outputable (XViaStrategy p), -Outputable (XViaStrategy GhcTc)), and pass that around in every context where -we might output a DerivStrategy. But a simpler alternative is to pass a -witness to whichever pass we're in. When we pattern-match on that (GADT) -witness, we learn the pass identity and can then print away. To wit, we get -the definition of GhcPass and the functions isPass. These allow us to do away -with big constraints, passing around all manner of dictionaries we might or -might not use. It does mean that we have to manually use isPass when printing, -but these places are few. - -See Note [NoGhcTc] about the superclass constraint to IsPass. - -Note [NoGhcTc] -~~~~~~~~~~~~~~ -An expression is parsed into HsExpr GhcPs, renamed into HsExpr GhcRn, and -then type-checked into HsExpr GhcTc. Not so for types! These get parsed -into HsType GhcPs, renamed into HsType GhcRn, and then type-checked into -Type. We never build an HsType GhcTc. Why do this? Because we need to be -able to compare type-checked types for equality, and we don't want to do -this with HsType. - -This causes wrinkles within the AST, where we normally think that the whole -AST travels through the GhcPs --> GhcRn --> GhcTc pipeline as one. So we -have the NoGhcTc type family, which just replaces GhcTc with GhcRn, so that -user-written types can be preserved (as HsType GhcRn) even in e.g. HsExpr GhcTc. - -For example, this is used in ExprWithTySig: - | ExprWithTySig - (XExprWithTySig p) - - (LHsExpr p) - (LHsSigWcType (NoGhcTc p)) - -If we have (e :: ty), we still want to be able to print that (with the :: ty) -after type-checking. So we retain the LHsSigWcType GhcRn, even in an -HsExpr GhcTc. That's what NoGhcTc does. - -When we're printing the type annotation, we need to know -(Outputable (LHsSigWcType GhcRn)), even though we've assumed only that -(OutputableBndrId GhcTc). We thus must be able to prove OutputableBndrId (NoGhcTc p) -from OutputableBndrId p. The extra constraints in OutputableBndrId and -the superclass constraints of IsPass allow this. Note that the superclass -constraint of IsPass is *recursive*: it asserts that IsPass (NoGhcTcPass p) holds. -For this to make sense, we need -XUndecidableSuperClasses and the other constraint, -saying that NoGhcTcPass is idempotent. - --} - type instance Anno RdrName = SrcSpanAnnN type instance Anno Name = SrcSpanAnnN type instance Anno Id = SrcSpanAnnN @@ -128,31 +72,6 @@ Bottom line: if you add a TTG extension constructor that uses DataConCantHappen, sure that any uses of it as a field are strict. -} --- | Allows us to check what phase we're in at GHC's runtime. --- For example, this class allows us to write --- --- @ --- f :: forall p. IsPass p => HsExpr (GhcPass p) -> blah --- f e = case ghcPass @p of --- GhcPs -> ... in this RHS we have HsExpr GhcPs... --- GhcRn -> ... in this RHS we have HsExpr GhcRn... --- GhcTc -> ... in this RHS we have HsExpr GhcTc... --- @ --- --- which is very useful, for example, when pretty-printing. --- See Note [IsPass]. -class ( NoGhcTcPass (NoGhcTcPass p) ~ NoGhcTcPass p - , IsPass (NoGhcTcPass p) - ) => IsPass p where - ghcPass :: GhcPass p - -instance IsPass 'Parsed where - ghcPass = GhcPs -instance IsPass 'Renamed where - ghcPass = GhcRn -instance IsPass 'Typechecked where - ghcPass = GhcTc - type instance IdP (GhcPass p) = IdGhcP p -- | Maps the "normal" id type for a given GHC pass @@ -171,20 +90,9 @@ type family IdOccGhcP pass where IdOccGhcP 'Typechecked = Id type LIdOccGhcP p = XRecGhc (IdOccGhcP p) --- | Marks that a field uses the GhcRn variant even when the pass --- parameter is GhcTc. Useful for storing HsTypes in GHC.Hs.Exprs, say, because --- HsType GhcTc should never occur. --- See Note [NoGhcTc] - --- Breaking it up this way, GHC can figure out that the result is a GhcPass -type instance NoGhcTc (GhcPass pass) = GhcPass (NoGhcTcPass pass) - -type family NoGhcTcPass (p :: Pass) :: Pass where - NoGhcTcPass 'Typechecked = 'Renamed - NoGhcTcPass other = other - -- |Constraint type to bundle up the requirement for 'OutputableBndr' on both --- the @id@ and the 'NoGhcTc' of it. See Note [NoGhcTc]. +-- the @id@ and the 'NoGhcTc' of it. +-- See Note [NoGhcTc] in "GHC.Hs.Extension.GhcPass". type OutputableBndrId pass = ( OutputableBndr (IdGhcP pass) , OutputableBndr (IdOccGhcP pass) @@ -209,11 +117,3 @@ pprIfRn pp = case ghcPass @p of GhcRn -> pp pprIfTc :: forall p. IsPass p => (p ~ 'Typechecked => SDoc) -> SDoc pprIfTc pp = case ghcPass @p of GhcTc -> pp _ -> empty - ---- Outputable - -instance Outputable NoExtField where - ppr _ = text "NoExtField" - -instance Outputable DataConCantHappen where - ppr = dataConCantHappen ===================================== compiler/GHC/Hs/Extension/GhcPass.hs ===================================== @@ -2,10 +2,14 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE KindSignatures #-} {-# LANGUAGE TypeFamilies #-} +{-# LANGUAGE UndecidableSuperClasses #-} {-# OPTIONS_GHC -Wno-orphans #-} --- The above is required for the type-family instances: --- * Anno HsDocStringChunk = SrcSpan +{- +Suppression of warnings are required for +the type-family instance(s): + - Anno HsDocStringChunk +-} module GHC.Hs.Extension.GhcPass where @@ -39,6 +43,105 @@ type GhcPs = GhcPass 'Parsed -- Output of parser type GhcRn = GhcPass 'Renamed -- Output of renamer type GhcTc = GhcPass 'Typechecked -- Output of typechecker +{- +Note [IsPass] +~~~~~~~~~~~~~ +One challenge with the Trees That Grow approach +is that we sometimes have different information in different passes. +For example, we have + + type instance XViaStrategy GhcPs = LHsSigType GhcPs + type instance XViaStrategy GhcRn = LHsSigType GhcRn + type instance XViaStrategy GhcTc = Type + +This means that printing a DerivStrategy (which contains an XViaStrategy) +might need to print a LHsSigType, or it might need to print a type. Yet we +want one Outputable instance for a DerivStrategy, instead of one per pass. We +could have a large constraint, including e.g. (Outputable (XViaStrategy p), +Outputable (XViaStrategy GhcTc)), and pass that around in every context where +we might output a DerivStrategy. But a simpler alternative is to pass a +witness to whichever pass we're in. When we pattern-match on that (GADT) +witness, we learn the pass identity and can then print away. To wit, we get +the definition of GhcPass and the functions isPass. These allow us to do away +with big constraints, passing around all manner of dictionaries we might or +might not use. It does mean that we have to manually use isPass when printing, +but these places are few. + +See Note [NoGhcTc] about the superclass constraint to IsPass. + +Note [NoGhcTc] +~~~~~~~~~~~~~~ +An expression is parsed into HsExpr GhcPs, renamed into HsExpr GhcRn, and +then type-checked into HsExpr GhcTc. Not so for types! These get parsed +into HsType GhcPs, renamed into HsType GhcRn, and then type-checked into +Type. We never build an HsType GhcTc. Why do this? Because we need to be +able to compare type-checked types for equality, and we don't want to do +this with HsType. + +This causes wrinkles within the AST, where we normally think that the whole +AST travels through the GhcPs --> GhcRn --> GhcTc pipeline as one. So we +have the NoGhcTc type family, which just replaces GhcTc with GhcRn, so that +user-written types can be preserved (as HsType GhcRn) even in e.g. HsExpr GhcTc. + +For example, this is used in ExprWithTySig: + | ExprWithTySig + (XExprWithTySig p) + + (LHsExpr p) + (LHsSigWcType (NoGhcTc p)) + +If we have (e :: ty), we still want to be able to print that (with the :: ty) +after type-checking. So we retain the LHsSigWcType GhcRn, even in an +HsExpr GhcTc. That's what NoGhcTc does. + +When we're printing the type annotation, we need to know +(Outputable (LHsSigWcType GhcRn)), even though we've assumed only that +(OutputableBndrId GhcTc). We thus must be able to prove OutputableBndrId (NoGhcTc p) +from OutputableBndrId p. The extra constraints in OutputableBndrId and +the superclass constraints of IsPass allow this. Note that the superclass +constraint of IsPass is *recursive*: it asserts that IsPass (NoGhcTcPass p) holds. +For this to make sense, we need -XUndecidableSuperClasses and the other constraint, +saying that NoGhcTcPass is idempotent. + +-} + +-- | Allows us to check what phase we're in at GHC's runtime. +-- For example, this class allows us to write +-- +-- @ +-- f :: forall p. IsPass p => HsExpr (GhcPass p) -> blah +-- f e = case ghcPass @p of +-- GhcPs -> ... in this RHS we have HsExpr GhcPs... +-- GhcRn -> ... in this RHS we have HsExpr GhcRn... +-- GhcTc -> ... in this RHS we have HsExpr GhcTc... +-- @ +-- +-- which is very useful, for example, when pretty-printing. +-- See Note [IsPass]. +class ( NoGhcTcPass (NoGhcTcPass p) ~ NoGhcTcPass p + , IsPass (NoGhcTcPass p) + ) => IsPass p where + ghcPass :: GhcPass p + +instance IsPass 'Parsed where + ghcPass = GhcPs +instance IsPass 'Renamed where + ghcPass = GhcRn +instance IsPass 'Typechecked where + ghcPass = GhcTc + +-- | Marks that a field uses the GhcRn variant even when the pass +-- parameter is GhcTc. Useful for storing HsTypes in GHC.Hs.Exprs, say, because +-- HsType GhcTc should never occur. +-- See Note [NoGhcTc] + +-- Breaking it up this way, GHC can figure out that the result is a GhcPass +type instance NoGhcTc (GhcPass pass) = GhcPass (NoGhcTcPass pass) + +type family NoGhcTcPass (p :: Pass) :: Pass where + NoGhcTcPass 'Typechecked = 'Renamed + NoGhcTcPass other = other + -- See Note [XRec and Anno in the AST] in GHC.Parser.Annotation type instance XRec (GhcPass p) a = XRecGhc a ===================================== compiler/GHC/Hs/ImpExp.hs ===================================== @@ -1,4 +1,50 @@ -{-# OPTIONS_GHC -Wno-orphans #-} -- Outputable and IEWrappedName +{-# OPTIONS_GHC -Wno-orphans #-} +{- +Suppression of warnings are required for +the type-class instance(s): + - Data (IEWrappedName GhcPs) + - Data (IEWrappedName GhcRn) + - Data (IEWrappedName GhcTc) + - Data (NamespaceSpecifier GhcPs) + - Data (NamespaceSpecifier GhcRn) + - Data (NamespaceSpecifier GhcTc) + - Eq (IEWrappedName GhcPs) + - Eq (IEWrappedName GhcRn) + - Eq (IEWrappedName GhcTc) + - Eq (NamespaceSpecifier GhcPs) + - Eq (NamespaceSpecifier GhcRn) + - Eq (NamespaceSpecifier GhcTc) + - HasOccName (IEWrappedName (GhcPass p)) + - Outputable (IE (GhcPass p)) + - Outputable (IEWrappedName (GhcPass p)) + - Outputable (ImportDecl (GhcPass p)) + - OutputableBndr (IEWrappedName (GhcPass p)) +and type-family instance(s): + - Anno + - ImportDeclPkgQual + - XCImportDecl + - XDataNamespaceSpecifier + - XIEData + - XIEDefault + - XIEDoc + - XIEDocNamed + - XIEGroup + - XIEModuleContents + - XIEName + - XIEPattern + - XIEThingAbs + - XIEThingAll + - XIEThingWith + - XIEType + - XIEVar + - XIEWholeNamespace + - XNoNamespaceSpecifier + - XTypeNamespaceSpecifier + - XXIE + - XXIEWrappedName + - XXImportDecl + - XXNamespaceSpecifier +-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE UndecidableInstances #-} -- Wrinkle in Note [Trees That Grow] -- in module Language.Haskell.Syntax.Extension ===================================== compiler/GHC/Hs/Specificity.hs deleted ===================================== @@ -1,19 +0,0 @@ -{-# OPTIONS_GHC -Wno-orphans #-} -- NFData -module GHC.Hs.Specificity where - -import Control.DeepSeq (NFData(..)) - -import Language.Haskell.Syntax.Specificity - -{- ********************************************************************* -* * -* ForAllTyFlag -* * -********************************************************************* -} - -instance NFData Specificity where - rnf SpecifiedSpec = () - rnf InferredSpec = () -instance NFData ForAllTyFlag where - rnf (Invisible spec) = rnf spec - rnf Required = () ===================================== compiler/GHC/Hs/Type.hs ===================================== @@ -1,9 +1,32 @@ {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE ViewPatterns #-} {-# LANGUAGE UndecidableInstances #-} -- Wrinkle in Note [Trees That Grow] - -- in module Language.Haskell.Syntax.Extension - -{-# OPTIONS_GHC -Wno-orphans #-} -- NamedThing, Outputable, OutputableBndrId + -- in module Language.Haskell.Syntax.Extension +{-# OPTIONS_GHC -Wno-orphans #-} +{- +Suppression of warnings are required for +the type-class instance(s): + - Outputable (FieldOcc (GhcPass p)) + - Outputable (HsArg (GhcPass p) tm ty) + - Outputable (HsBndrVar (GhcPass p)) + - Outputable (HsConDeclRecField (GhcPass p)) + - Outputable (HsConDetails (GhcPass p) arg rec) + - Outputable (HsContextDetails (GhcPass p) arg) + - Outputable (HsForAllTelescope (GhcPass p)) + - Outputable (HsOuterTyVarBndrs flag (GhcPass p)) + - Outputable (HsPatSigType (GhcPass p)) + - Outputable (HsSigType (GhcPass p)) + - Outputable (HsTyPat (GhcPass p)) + - Outputable (HsTyVarBndr flag (GhcPass p)) + - Outputable (HsType (GhcPass p)) + - Outputable (HsWildCardBndrs (GhcPass p) thing) + - Outputable (LHsQTyVars (GhcPass p)) + - OutputableBndr (FieldOcc (GhcPass pass)) + - OutputableBndr (GenLocated SrcSpan (FieldOcc (GhcPass pass))) +and type-family instance(s): + - Anno + - X*/XX* extension points (over 50) for data-types defined in 'Language.Haskell.Syntax.Type' +-} {- (c) The University of Glasgow 2006 ===================================== compiler/GHC/Types/Hint/Ppr.hs ===================================== @@ -1,6 +1,11 @@ {-# LANGUAGE OverloadedStrings #-} -{-# OPTIONS_GHC -Wno-orphans #-} {- instance Outputable GhcHint -} +{-# OPTIONS_GHC -Wno-orphans #-} +{- +Suppression of warnings are required for +the type-class instance(s): + - Outputable GhcHint +-} module GHC.Types.Hint.Ppr ( perhapsAsPat, pprSigLike ===================================== compiler/GHC/Types/InlinePragma.hs ===================================== @@ -10,13 +10,13 @@ {-# OPTIONS_GHC -Wno-orphans #-} {- -Suppression of warnings are required for instances: - - Binary Activation - - Binary CompilerPhase - - Binary InlineSaturation - - Binary XActivation - - Binary XInlinePragmaGhc - - Outputable CompilerPhase +Suppression of warnings are required for +the type-class instance(s): + - Outputable (InlinePragma (GhcPass p)) +and type-family instance(s): + - XInlinePragma + - XXInlinePragma + - XXActivation -} module GHC.Types.InlinePragma ===================================== compiler/GHC/Types/Var.hs ===================================== @@ -129,7 +129,6 @@ import GHC.Utils.Binary import GHC.Utils.Outputable import GHC.Utils.Panic -import GHC.Hs.Specificity () import Language.Haskell.Syntax.Specificity import Control.DeepSeq ===================================== compiler/GHC/Utils/Outputable.hs ===================================== @@ -123,6 +123,8 @@ import Language.Haskell.Syntax.Decls.Foreign ( CCallConv(..), CExportSpec(..), Safety(..) ) import Language.Haskell.Syntax.Decls.Overlap ( OverlapMode(..) ) import Language.Haskell.Syntax.Doc +import Language.Haskell.Syntax.Extension + ( DataConCantHappen, NoExtField, dataConCantHappen ) import Language.Haskell.Syntax.ImpExp ( NamespaceSpecifier(..) ) import Language.Haskell.Syntax.Module.Name ( ModuleName(..) ) import Language.Haskell.Syntax.Specificity @@ -1116,6 +1118,12 @@ instance Outputable Serialized where instance Outputable Extension where ppr = text . show +instance Outputable NoExtField where + ppr _ = text "NoExtField" + +instance Outputable DataConCantHappen where + ppr = dataConCantHappen + instance Outputable ModuleName where ppr = pprModuleName ===================================== compiler/Language/Haskell/Syntax/Specificity.hs ===================================== @@ -14,6 +14,7 @@ module Language.Haskell.Syntax.Specificity ( import Prelude +import Control.DeepSeq (NFData(..)) import Data.Data -- | ForAllTyFlag @@ -42,6 +43,14 @@ pattern Specified = Invisible SpecifiedSpec {-# COMPLETE Required, Specified, Inferred #-} +instance NFData Specificity where + rnf SpecifiedSpec = () + rnf InferredSpec = () + +instance NFData ForAllTyFlag where + rnf (Invisible spec) = rnf spec + rnf Required = () + -- | Does this 'ForAllTyFlag' classify an argument that is written in Haskell? isVisibleForAllTyFlag :: ForAllTyFlag -> Bool isVisibleForAllTyFlag af = not (isInvisibleForAllTyFlag af) ===================================== compiler/ghc.cabal.in ===================================== @@ -566,7 +566,6 @@ Library GHC.Hs.Instances GHC.Hs.Lit GHC.Hs.Pat - GHC.Hs.Specificity GHC.Hs.Stats GHC.HsToCore GHC.HsToCore.Arrows View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/78a765c3996d42a597e60c4335387f6... -- View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/78a765c3996d42a597e60c4335387f6... You're receiving this email because of your account on gitlab.haskell.org.
participants (1)
-
recursion-ninja (@recursion-ninja)