summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2017-11-23 09:33:03 +0200
committerAlan Zimmerman <alan.zimm@gmail.com>2017-11-23 09:33:03 +0200
commit8444749c74b39a1d0c2669623d48fc5e99569be3 (patch)
tree3984274c4f888efc35b97e1750c4121cc3d4ad92
parent468d7819ab0d7848c3c7910b40d0102efca43590 (diff)
downloadhaskell-8444749c74b39a1d0c2669623d48fc5e99569be3.tar.gz
Separate Data Instance generation into HsInstances
And derive concrete instances for GhcPs, GhcRn, GhcTc Requires bootstrapping with at least GHC 8.2.1
-rw-r--r--compiler/ghc.cabal.in1
-rw-r--r--compiler/hsSyn/HsBinds.hs22
-rw-r--r--compiler/hsSyn/HsDecls.hs58
-rw-r--r--compiler/hsSyn/HsExpr.hs47
-rw-r--r--compiler/hsSyn/HsExpr.hs-boot15
-rw-r--r--compiler/hsSyn/HsImpExp.hs4
-rw-r--r--compiler/hsSyn/HsLit.hs4
-rw-r--r--compiler/hsSyn/HsPat.hs4
-rw-r--r--compiler/hsSyn/HsPat.hs-boot5
-rw-r--r--compiler/hsSyn/HsSyn.hs6
-rw-r--r--compiler/hsSyn/HsTypes.hs20
11 files changed, 95 insertions, 91 deletions
diff --git a/compiler/ghc.cabal.in b/compiler/ghc.cabal.in
index 3b99db10b0..8501306b25 100644
--- a/compiler/ghc.cabal.in
+++ b/compiler/ghc.cabal.in
@@ -320,6 +320,7 @@ Library
HsLit
PlaceHolder
HsExtension
+ HsInstances
HsPat
HsSyn
HsTypes
diff --git a/compiler/hsSyn/HsBinds.hs b/compiler/hsSyn/HsBinds.hs
index 10e1307367..debeaecbff 100644
--- a/compiler/hsSyn/HsBinds.hs
+++ b/compiler/hsSyn/HsBinds.hs
@@ -92,7 +92,7 @@ data HsLocalBindsLR idL idR
type LHsLocalBindsLR idL idR = Located (HsLocalBindsLR idL idR)
-deriving instance (DataIdLR idL idR) => Data (HsLocalBindsLR idL idR)
+-- deriving instance (DataIdLR idL idR) => Data (HsLocalBindsLR idL idR)
-- | Haskell Value Bindings
type HsValBinds id = HsValBindsLR id id
@@ -118,7 +118,7 @@ data HsValBindsLR idL idR
| XValBindsLR
(XXValBindsLR idL idR)
-deriving instance (DataIdLR idL idR) => Data (HsValBindsLR idL idR)
+-- deriving instance (DataIdLR idL idR) => Data (HsValBindsLR idL idR)
-- ---------------------------------------------------------------------
-- Deal with ValBindsOut
@@ -128,7 +128,7 @@ data NHsValBindsLR idL
= NValBinds
[(RecFlag, LHsBinds idL)]
[LSig GhcRn]
-deriving instance (DataIdLR idL idL) => Data (NHsValBindsLR idL)
+-- deriving instance (DataIdLR idL idL) => Data (NHsValBindsLR idL)
type instance XValBinds (GhcPass pL) (GhcPass pR) = PlaceHolder
type instance XXValBindsLR (GhcPass pL) (GhcPass pR)
@@ -305,7 +305,7 @@ data HsBindLR idL idR
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR idL idR) => Data (HsBindLR idL idR)
+-- deriving instance (DataIdLR idL idR) => Data (HsBindLR idL idR)
-- Consider (AbsBinds tvs ds [(ftvs, poly_f, mono_f) binds]
--
@@ -327,7 +327,7 @@ data ABExport p
-- Shape: (forall abs_tvs. abs_ev_vars => abe_mono) ~ abe_poly
, abe_prags :: TcSpecPrags -- ^ SPECIALISE pragmas
}
-deriving instance (DataId p) => Data (ABExport p)
+-- deriving instance (DataId p) => Data (ABExport p)
-- | - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnPattern',
-- 'ApiAnnotation.AnnEqual','ApiAnnotation.AnnLarrow'
@@ -345,7 +345,7 @@ data PatSynBind idL idR
psb_def :: LPat idR, -- ^ Right-hand side
psb_dir :: HsPatSynDir idR -- ^ Directionality
}
-deriving instance (DataIdLR idL idR) => Data (PatSynBind idL idR)
+-- deriving instance (DataIdLR idL idR) => Data (PatSynBind idL idR)
{-
Note [AbsBinds]
@@ -776,7 +776,7 @@ data HsIPBinds id
[LIPBind id]
TcEvBinds -- Only in typechecker output; binds
-- uses of the implicit parameters
-deriving instance (DataIdLR id id) => Data (HsIPBinds id)
+-- deriving instance (DataIdLR id id) => Data (HsIPBinds id)
isEmptyIPBinds :: HsIPBinds id -> Bool
isEmptyIPBinds (IPBinds is ds) = null is && isEmptyTcEvBinds ds
@@ -800,7 +800,7 @@ type LIPBind id = Located (IPBind id)
-- For details on above see note [Api annotations] in ApiAnnotation
data IPBind id
= IPBind (Either (Located HsIPName) (IdP id)) (LHsExpr id)
-deriving instance (DataIdLR id id) => Data (IPBind id)
+-- deriving instance (DataIdLR id id) => Data (IPBind id)
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
=> Outputable (HsIPBinds (GhcPass p)) where
@@ -974,14 +974,14 @@ data Sig pass
(Located [Located (IdP pass)])
(Maybe (Located (IdP pass)))
-deriving instance (DataIdLR pass pass) => Data (Sig pass)
+-- deriving instance (DataIdLR pass pass) => Data (Sig pass)
-- | Located Fixity Signature
type LFixitySig pass = Located (FixitySig pass)
-- | Fixity Signature
data FixitySig pass = FixitySig [Located (IdP pass)] Fixity
-deriving instance (DataId pass) => Data (FixitySig pass)
+-- deriving instance (DataId pass) => Data (FixitySig pass)
-- | Type checker Specialisation Pragmas
--
@@ -1268,4 +1268,4 @@ data HsPatSynDir id
= Unidirectional
| ImplicitBidirectional
| ExplicitBidirectional (MatchGroup id (LHsExpr id))
-deriving instance (DataIdLR id id) => Data (HsPatSynDir id)
+-- deriving instance (DataIdLR id id) => Data (HsPatSynDir id)
diff --git a/compiler/hsSyn/HsDecls.hs b/compiler/hsSyn/HsDecls.hs
index 9e05a3d1c1..84bddfc5bc 100644
--- a/compiler/hsSyn/HsDecls.hs
+++ b/compiler/hsSyn/HsDecls.hs
@@ -149,7 +149,7 @@ data HsDecl id
-- (Includes quasi-quotes)
| DocD (DocDecl) -- ^ Documentation comment declaration
| RoleAnnotD (RoleAnnotDecl id) -- ^ Role annotation declaration
-deriving instance (DataIdLR id id) => Data (HsDecl id)
+-- deriving instance (DataIdLR id id) => Data (HsDecl id)
-- NB: all top-level fixity decls are contained EITHER
@@ -195,7 +195,7 @@ data HsGroup id
hs_docs :: [LDocDecl]
}
-deriving instance (DataIdLR id id) => Data (HsGroup id)
+-- deriving instance (DataIdLR id id) => Data (HsGroup id)
emptyGroup, emptyRdrGroup, emptyRnGroup :: HsGroup (GhcPass a)
emptyRdrGroup = emptyGroup { hs_valds = emptyValBindsIn }
@@ -316,7 +316,7 @@ data SpliceDecl id
= SpliceDecl -- Top level splice
(Located (HsSplice id))
SpliceExplicitFlag
-deriving instance (DataIdLR id id) => Data (SpliceDecl id)
+-- deriving instance (DataIdLR id id) => Data (SpliceDecl id)
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
=> Outputable (SpliceDecl (GhcPass p)) where
@@ -539,7 +539,7 @@ data TyClDecl pass
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR id id) => Data (TyClDecl id)
+-- deriving instance (DataIdLR id id) => Data (TyClDecl id)
-- Simple classifiers for TyClDecl
@@ -784,7 +784,7 @@ data TyClGroup pass -- See Note [TyClGroups and dependency analysis]
= TyClGroup { group_tyclds :: [LTyClDecl pass]
, group_roles :: [LRoleAnnotDecl pass]
, group_instds :: [LInstDecl pass] }
-deriving instance (DataIdLR id id) => Data (TyClGroup id)
+-- deriving instance (DataIdLR id id) => Data (TyClGroup id)
emptyTyClGroup :: TyClGroup pass
emptyTyClGroup = TyClGroup [] [] []
@@ -900,7 +900,7 @@ data FamilyResultSig pass = -- see Note [FamilyResultSig]
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR pass pass) => Data (FamilyResultSig pass)
+-- deriving instance (DataIdLR pass pass) => Data (FamilyResultSig pass)
-- | Located type Family Declaration
type LFamilyDecl pass = Located (FamilyDecl pass)
@@ -923,7 +923,7 @@ data FamilyDecl pass = FamilyDecl
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR id id) => Data (FamilyDecl id)
+-- deriving instance (DataIdLR id id) => Data (FamilyDecl id)
-- | Located Injectivity Annotation
type LInjectivityAnn pass = Located (InjectivityAnn pass)
@@ -942,7 +942,7 @@ data InjectivityAnn pass
-- 'ApiAnnotation.AnnRarrow', 'ApiAnnotation.AnnVbar'
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataId pass) => Data (InjectivityAnn pass)
+-- deriving instance (DataId pass) => Data (InjectivityAnn pass)
data FamilyInfo pass
= DataFamily
@@ -950,7 +950,7 @@ data FamilyInfo pass
-- | 'Nothing' if we're in an hs-boot file and the user
-- said "type family Foo x where .."
| ClosedTypeFamily (Maybe [LTyFamInstEqn pass])
-deriving instance (DataIdLR pass pass) => Data (FamilyInfo pass)
+-- deriving instance (DataIdLR pass pass) => Data (FamilyInfo pass)
-- | Does this family declaration have a complete, user-supplied kind signature?
famDeclHasCusk :: Maybe Bool
@@ -1058,7 +1058,7 @@ data HsDataDefn pass -- The payload of a data type defn
-- For details on above see note [Api annotations] in ApiAnnotation
}
-deriving instance (DataIdLR id id) => Data (HsDataDefn id)
+-- deriving instance (DataIdLR id id) => Data (HsDataDefn id)
-- | Haskell Deriving clause
type HsDeriving pass = Located [LHsDerivingClause pass]
@@ -1094,7 +1094,7 @@ data HsDerivingClause pass
--
-- should produce a derived instance for @C [a] (T b)@.
}
-deriving instance (DataIdLR id id) => Data (HsDerivingClause id)
+-- deriving instance (DataIdLR id id) => Data (HsDerivingClause id)
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
=> Outputable (HsDerivingClause (GhcPass p)) where
@@ -1177,7 +1177,7 @@ data ConDecl pass
, con_doc :: Maybe LHsDocString
-- ^ A possible Haddock comment.
}
-deriving instance (DataIdLR pass pass) => Data (ConDecl pass)
+-- deriving instance (DataIdLR pass pass) => Data (ConDecl pass)
-- | Haskell data Constructor Declaration Details
type HsConDeclDetails pass
@@ -1383,7 +1383,7 @@ newtype TyFamInstDecl pass = TyFamInstDecl { tfid_eqn :: TyFamInstEqn pass }
-- 'ApiAnnotation.AnnInstance',
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance DataIdLR pass pass => Data (TyFamInstDecl pass)
+-- deriving instance DataIdLR pass pass => Data (TyFamInstDecl pass)
----------------- Data family instances -------------
@@ -1401,7 +1401,7 @@ newtype DataFamInstDecl pass
-- 'ApiAnnotation.AnnClose'
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance DataIdLR pass pass => Data (DataFamInstDecl pass)
+-- deriving instance DataIdLR pass pass => Data (DataFamInstDecl pass)
----------------- Family instances (common types) -------------
@@ -1431,8 +1431,8 @@ data FamEqn pass pats rhs
-- - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnEqual'
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataId pass, Data pats, Data rhs)
- => Data (FamEqn pass pats rhs)
+-- deriving instance (DataId pass, Data pats, Data rhs)
+-- => Data (FamEqn pass pats rhs)
----------------- Class instances -------------
@@ -1461,7 +1461,7 @@ data ClsInstDecl pass
-- 'ApiAnnotation.AnnOpen','ApiAnnotation.AnnClose',
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR id id) => Data (ClsInstDecl id)
+-- deriving instance (DataIdLR id id) => Data (ClsInstDecl id)
----------------- Instances of all kinds -------------
@@ -1477,7 +1477,7 @@ data InstDecl pass -- Both class and family instances
{ dfid_inst :: DataFamInstDecl pass }
| TyFamInstD -- type family instance
{ tfid_inst :: TyFamInstDecl pass }
-deriving instance (DataIdLR id id) => Data (InstDecl id)
+-- deriving instance (DataIdLR id id) => Data (InstDecl id)
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
=> Outputable (TyFamInstDecl (GhcPass p)) where
@@ -1634,7 +1634,7 @@ data DerivDecl pass = DerivDecl
-- For details on above see note [Api annotations] in ApiAnnotation
}
-deriving instance (DataIdLR pass pass) => Data (DerivDecl pass)
+-- deriving instance (DataIdLR pass pass) => Data (DerivDecl pass)
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
=> Outputable (DerivDecl (GhcPass p)) where
@@ -1669,7 +1669,7 @@ data DefaultDecl pass
-- 'ApiAnnotation.AnnOpen','ApiAnnotation.AnnClose'
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR pass pass) => Data (DefaultDecl pass)
+-- deriving instance (DataIdLR pass pass) => Data (DefaultDecl pass)
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
=> Outputable (DefaultDecl (GhcPass p)) where
@@ -1714,7 +1714,7 @@ data ForeignDecl pass
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR pass pass) => Data (ForeignDecl pass)
+-- deriving instance (DataIdLR pass pass) => Data (ForeignDecl pass)
{-
In both ForeignImport and ForeignExport:
sig_ty is the type given in the Haskell code
@@ -1831,7 +1831,7 @@ type LRuleDecls pass = Located (RuleDecls pass)
-- | Rule Declarations
data RuleDecls pass = HsRules { rds_src :: SourceText
, rds_rules :: [LRuleDecl pass] }
-deriving instance (DataIdLR pass pass) => Data (RuleDecls pass)
+-- deriving instance (DataIdLR pass pass) => Data (RuleDecls pass)
-- | Located Rule Declaration
type LRuleDecl pass = Located (RuleDecl pass)
@@ -1857,7 +1857,7 @@ data RuleDecl pass
-- 'ApiAnnotation.AnnEqual',
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR pass pass) => Data (RuleDecl pass)
+-- deriving instance (DataIdLR pass pass) => Data (RuleDecl pass)
flattenRuleDecls :: [LRuleDecls pass] -> [LRuleDecl pass]
flattenRuleDecls decls = concatMap (rds_rules . unLoc) decls
@@ -1874,7 +1874,7 @@ data RuleBndr pass
-- 'ApiAnnotation.AnnDcolon','ApiAnnotation.AnnClose'
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR pass pass) => Data (RuleBndr pass)
+-- deriving instance (DataIdLR pass pass) => Data (RuleBndr pass)
collectRuleBndrSigTys :: [RuleBndr pass] -> [LHsSigWcType pass]
collectRuleBndrSigTys bndrs = [ty | RuleBndrSig _ ty <- bndrs]
@@ -1967,7 +1967,7 @@ data VectDecl pass
(LHsSigType pass)
| HsVectInstOut -- post type-checking (always SCALAR) !!!FIXME: should be superfluous now
ClsInst
-deriving instance (DataIdLR pass pass) => Data (VectDecl pass)
+-- deriving instance (DataIdLR pass pass) => Data (VectDecl pass)
lvectDeclName :: NamedThing (IdP pass) => LVectDecl pass -> Name
lvectDeclName (L _ (HsVect _ (L _ name) _)) = getName name
@@ -2066,14 +2066,14 @@ type LWarnDecls pass = Located (WarnDecls pass)
data WarnDecls pass = Warnings { wd_src :: SourceText
, wd_warnings :: [LWarnDecl pass]
}
-deriving instance (DataId pass) => Data (WarnDecls pass)
+-- deriving instance (DataId pass) => Data (WarnDecls pass)
-- | Located Warning pragma Declaration
type LWarnDecl pass = Located (WarnDecl pass)
-- | Warning pragma Declaration
data WarnDecl pass = Warning [Located (IdP pass)] WarningTxt
-deriving instance (DataId pass) => Data (WarnDecl pass)
+-- deriving instance (DataId pass) => Data (WarnDecl pass)
instance OutputableBndr (IdP pass) => Outputable (WarnDecls pass) where
ppr (Warnings (SourceText src) decls)
@@ -2106,7 +2106,7 @@ data AnnDecl pass = HsAnnotation
-- 'ApiAnnotation.AnnClose'
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR pass pass) => Data (AnnDecl pass)
+-- deriving instance (DataIdLR pass pass) => Data (AnnDecl pass)
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
=> Outputable (AnnDecl (GhcPass p)) where
@@ -2155,7 +2155,7 @@ data RoleAnnotDecl pass
-- 'ApiAnnotation.AnnRole'
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataId pass) => Data (RoleAnnotDecl pass)
+-- deriving instance (DataId pass) => Data (RoleAnnotDecl pass)
instance OutputableBndr (IdP pass) => Outputable (RoleAnnotDecl pass) where
ppr (RoleAnnotDecl ltycon roles)
diff --git a/compiler/hsSyn/HsExpr.hs b/compiler/hsSyn/HsExpr.hs
index 6b3440ae8b..c44d96a630 100644
--- a/compiler/hsSyn/HsExpr.hs
+++ b/compiler/hsSyn/HsExpr.hs
@@ -112,7 +112,7 @@ noPostTcTable = []
data SyntaxExpr p = SyntaxExpr { syn_expr :: HsExpr p
, syn_arg_wraps :: [HsWrapper]
, syn_res_wrap :: HsWrapper }
-deriving instance (DataIdLR p p) => Data (SyntaxExpr p)
+-- deriving instance (DataIdLR p p) => Data (SyntaxExpr p)
-- | This is used for rebindable-syntax pieces that are too polymorphic
-- for tcSyntaxOp (trS_fmap and the mzip in ParStmt)
@@ -720,13 +720,14 @@ data HsExpr p
| XExpr (XXExpr p) -- Note [Trees that Grow] extension constructor
-deriving instance (DataIdLR p p) => Data (HsExpr p)
+-- deriving instance (DataIdLR p p) => Data (HsExpr p)
-- | Extra data fields for a 'RecordCon', added by the type checker
data RecordConTc = RecordConTc
{ rcon_con_like :: ConLike -- The data constructor or pattern synonym
, rcon_con_expr :: PostTcExpr -- Instantiated constructor function
- } deriving Data
+ }
+ -- } deriving Data
-- | Extra data fields for a 'RecordUpd', added by the type checker
@@ -863,7 +864,7 @@ data HsTupArg id
= Present (XPresent id) (LHsExpr id) -- ^ The argument
| Missing (XMissing id) -- ^ The argument is missing, but this is its type
| XTupArg (XXTupArg id) -- ^ Note [Trees that Grow] extension point
-deriving instance (DataIdLR id id) => Data (HsTupArg id)
+-- deriving instance (DataIdLR id id) => Data (HsTupArg id)
type instance XPresent (GhcPass _) = PlaceHolder
@@ -1416,7 +1417,7 @@ data HsCmd id
-- wrap :: arg1 "->" arg2
-- Then (HsCmdWrap wrap cmd) :: arg2 --> res
| XCmd (XXCmd id) -- Note [Trees that Grow] extension point
-deriving instance (DataIdLR id id) => Data (HsCmd id)
+-- deriving instance (DataIdLR id id) => Data (HsCmd id)
type instance XCmdArrApp GhcPs = PlaceHolder
type instance XCmdArrApp GhcRn = PlaceHolder
@@ -1455,13 +1456,13 @@ data HsCmdTop p
= HsCmdTop (XCmdTop p)
(LHsCmd p)
| XCmdTop (XXCmdTop p) -- Note [Trees that Grow] extension point
-deriving instance (DataIdLR p p) => Data (HsCmdTop p)
+-- deriving instance (DataIdLR p p) => Data (HsCmdTop p)
data CmdTopTc
= CmdTopTc Type -- Nested tuple of inputs on the command's stack
Type -- return type of the command
(CmdSyntaxTable GhcTc) -- See Note [CmdSyntaxTable]
- deriving Data
+ -- deriving Data
type instance XCmdTop GhcPs = PlaceHolder
type instance XCmdTop GhcRn = CmdSyntaxTable GhcRn -- See Note [CmdSyntaxTable]
@@ -1614,7 +1615,7 @@ data MatchGroup p body
-- The type is the type of the entire group
-- t1 -> ... -> tn -> tr
-- where there are n patterns
-deriving instance (Data body,DataIdLR p p) => Data (MatchGroup p body)
+-- deriving instance (Data body,DataIdLR p p) => Data (MatchGroup p body)
-- | Located Match
type LMatch id body = Located (Match id body)
@@ -1630,7 +1631,7 @@ data Match p body
m_pats :: [LPat p], -- The patterns
m_grhss :: (GRHSs p body)
}
-deriving instance (Data body,DataIdLR p p) => Data (Match p body)
+-- deriving instance (Data body,DataIdLR p p) => Data (Match p body)
instance (SourceTextX (GhcPass idR), OutputableBndrId (GhcPass idR),
Outputable body)
@@ -1717,7 +1718,7 @@ data GRHSs p body
grhssGRHSs :: [LGRHS p body], -- ^ Guarded RHSs
grhssLocalBinds :: LHsLocalBinds p -- ^ The where clause
}
-deriving instance (Data body,DataIdLR p p) => Data (GRHSs p body)
+-- deriving instance (Data body,DataIdLR p p) => Data (GRHSs p body)
-- | Located Guarded Right-Hand Side
type LGRHS id body = Located (GRHS id body)
@@ -1726,7 +1727,7 @@ type LGRHS id body = Located (GRHS id body)
-- | Guarded Right Hand Side.
data GRHS id body = GRHS [GuardLStmt id] -- Guards
body -- Right hand side
-deriving instance (Data body,DataIdLR id id) => Data (GRHS id body)
+-- deriving instance (Data body,DataIdLR id id) => Data (GRHS id body)
-- We know the list must have at least one @Match@ in it.
@@ -1984,8 +1985,8 @@ data StmtLR idL idR body -- body should always be (LHs**** idR)
-- With rebindable syntax the type might not
-- be quite as simple as (m (tya, tyb, tyc)).
}
-deriving instance (Data body, DataIdLR idL idR)
- => Data (StmtLR idL idR body)
+-- deriving instance (Data body, DataIdLR idL idR)
+-- => Data (StmtLR idL idR body)
data TransForm -- The 'f' below is the 'using' function, 'e' is the by function
= ThenForm -- then f or then f by e (depending on trS_by)
@@ -2000,7 +2001,7 @@ data ParStmtBlock idL idR
[IdP idR] -- The variables to be returned
(SyntaxExpr idR) -- The return operator
| XParStmtBlock (XXParStmtBlock idL idR)
-deriving instance (DataIdLR idL idR) => Data (ParStmtBlock idL idR)
+-- deriving instance (DataIdLR idL idR) => Data (ParStmtBlock idL idR)
type instance XParStmtBlock (GhcPass pL) (GhcPass pR) = PlaceHolder
type instance XXParStmtBlock (GhcPass pL) (GhcPass pR) = PlaceHolder
@@ -2018,7 +2019,7 @@ data ApplicativeArg idL
[ExprLStmt idL] -- stmts
(HsExpr idL) -- return (v1,..,vn), or just (v1,..,vn)
(LPat idL) -- (v1,...,vn)
-deriving instance (DataIdLR idL idL) => Data (ApplicativeArg idL)
+-- deriving instance (DataIdLR idL idL) => Data (ApplicativeArg idL)
{-
Note [The type of bind in Stmts]
@@ -2371,7 +2372,7 @@ data HsSplice id
(HsSplicedThing id) -- The result of splicing
| XSplice (XXSplice id) -- Note [Trees that Grow] extension point
deriving Typeable
-deriving instance (DataIdLR id id) => Data (HsSplice id)
+-- deriving instance (DataIdLR id id) => Data (HsSplice id)
type instance XTypedSplice (GhcPass _) = PlaceHolder
@@ -2421,7 +2422,7 @@ data HsSplicedThing id
| HsSplicedPat (Pat id) -- ^ Haskell Spliced Pattern
deriving Typeable
-deriving instance (DataIdLR id id) => Data (HsSplicedThing id)
+-- deriving instance (DataIdLR id id) => Data (HsSplicedThing id)
-- See Note [Pending Splices]
type SplicePointName = Name
@@ -2430,7 +2431,7 @@ type SplicePointName = Name
data PendingRnSplice
-- AZ:TODO: The hard-coded GhcRn feels wrong. How to force the PostRn?
= PendingRnSplice UntypedSpliceFlavour SplicePointName (LHsExpr GhcRn)
- deriving Data
+ -- deriving Data
data UntypedSpliceFlavour
= UntypedExpSplice
@@ -2443,7 +2444,7 @@ data UntypedSpliceFlavour
data PendingTcSplice
-- AZ:TODO: The hard-coded GhcTc feels wrong. How to force the PostTc?
= PendingTcSplice SplicePointName (LHsExpr GhcTc)
- deriving Data
+ -- deriving Data
{-
Note [Pending Splices]
@@ -2573,7 +2574,7 @@ data HsBracket p
-- (The Bool flag is used only in pprHsBracket)
| TExpBr (XTExpBr p) (LHsExpr p) -- [|| expr ||]
| XBracket (XXBracket p) -- Note [Trees that Grow] extension point
-deriving instance (DataIdLR p p) => Data (HsBracket p)
+-- deriving instance (DataIdLR p p) => Data (HsBracket p)
type instance XExpBr (GhcPass _) = PlaceHolder
type instance XPatBr (GhcPass _) = PlaceHolder
@@ -2638,7 +2639,7 @@ data ArithSeqInfo id
| FromThenTo (LHsExpr id)
(LHsExpr id)
(LHsExpr id)
-deriving instance (DataIdLR id id) => Data (ArithSeqInfo id)
+-- deriving instance (DataIdLR id id) => Data (ArithSeqInfo id)
-- AZ: Sould ArithSeqInfo have a TTG extension?
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
@@ -2689,7 +2690,7 @@ data HsMatchContext id -- Not an extensible tag
| ThPatQuote -- ^A Template Haskell pattern quotation [p| (a,b) |]
| PatSyn -- ^A pattern synonym declaration
deriving Functor
-deriving instance (Data id) => Data (HsMatchContext id)
+-- deriving instance (Data id) => Data (HsMatchContext id)
instance OutputableBndr id => Outputable (HsMatchContext id) where
ppr m@(FunRhs{}) = text "FunRhs" <+> ppr (mc_fun m) <+> ppr (mc_fixity m)
@@ -2726,7 +2727,7 @@ data HsStmtContext id
| ParStmtCtxt (HsStmtContext id) -- ^A branch of a parallel stmt
| TransStmtCtxt (HsStmtContext id) -- ^A branch of a transform stmt
deriving Functor
-deriving instance (Data id) => Data (HsStmtContext id)
+-- deriving instance (Data id) => Data (HsStmtContext id)
isListCompExpr :: HsStmtContext id -> Bool
-- Uses syntax [ e | quals ]
diff --git a/compiler/hsSyn/HsExpr.hs-boot b/compiler/hsSyn/HsExpr.hs-boot
index 500d601477..45f2dcc83e 100644
--- a/compiler/hsSyn/HsExpr.hs-boot
+++ b/compiler/hsSyn/HsExpr.hs-boot
@@ -13,8 +13,7 @@ import SrcLoc ( Located )
import Outputable ( SDoc, Outputable )
import {-# SOURCE #-} HsPat ( LPat )
import BasicTypes ( SpliceExplicitFlag(..))
-import HsExtension ( OutputableBndrId, DataIdLR, SourceTextX, GhcPass )
-import Data.Data hiding ( Fixity )
+import HsExtension ( OutputableBndrId, SourceTextX, GhcPass )
type role HsExpr nominal
type role HsCmd nominal
@@ -29,12 +28,12 @@ data MatchGroup (a :: *) (body :: *)
data GRHSs (a :: *) (body :: *)
data SyntaxExpr (i :: *)
-instance (DataIdLR p p) => Data (HsSplice p)
-instance (DataIdLR p p) => Data (HsExpr p)
-instance (DataIdLR p p) => Data (HsCmd p)
-instance (Data body,DataIdLR p p) => Data (MatchGroup p body)
-instance (Data body,DataIdLR p p) => Data (GRHSs p body)
-instance (DataIdLR p p) => Data (SyntaxExpr p)
+-- instance (DataIdLR p p) => Data (HsSplice p)
+-- instance (DataIdLR p p) => Data (HsExpr p)
+-- instance (DataIdLR p p) => Data (HsCmd p)
+-- instance (Data body,DataIdLR p p) => Data (MatchGroup p body)
+-- instance (Data body,DataIdLR p p) => Data (GRHSs p body)
+-- instance (DataIdLR p p) => Data (SyntaxExpr p)
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
=> Outputable (HsExpr (GhcPass p))
diff --git a/compiler/hsSyn/HsImpExp.hs b/compiler/hsSyn/HsImpExp.hs
index 2930b51ee2..77dd02ccf1 100644
--- a/compiler/hsSyn/HsImpExp.hs
+++ b/compiler/hsSyn/HsImpExp.hs
@@ -80,7 +80,7 @@ data ImportDecl name
-- to location in ideclHiding
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataId name) => Data (ImportDecl name)
+-- deriving instance (DataId name) => Data (ImportDecl name)
simpleImportDecl :: ModuleName -> ImportDecl name
simpleImportDecl mn = ImportDecl {
@@ -218,7 +218,7 @@ data IE name
| IEDocNamed String -- ^ Reference to named doc
-- deriving (Eq, Data)
deriving instance (Eq name, Eq (IdP name)) => Eq (IE name)
-deriving instance (DataId name) => Data (IE name)
+-- deriving instance (DataId name) => Data (IE name)
-- | Imported or Exported Wildcard
data IEWildcard = NoIEWildcard | IEWildcard Int deriving (Eq, Data)
diff --git a/compiler/hsSyn/HsLit.hs b/compiler/hsSyn/HsLit.hs
index a47b0ff4fe..471815a160 100644
--- a/compiler/hsSyn/HsLit.hs
+++ b/compiler/hsSyn/HsLit.hs
@@ -80,7 +80,7 @@ data HsLit x
| XLit (XXLit x)
-deriving instance (DataId x) => Data (HsLit x)
+-- deriving instance (DataId x) => Data (HsLit x)
type instance XHsChar (GhcPass _) = SourceText
type instance XHsCharPrim (GhcPass _) = SourceText
@@ -123,7 +123,7 @@ data HsOverLit p
| XOverLit
(XXOverLit p)
-deriving instance (DataIdLR p p) => Data (HsOverLit p)
+-- deriving instance (DataIdLR p p) => Data (HsOverLit p)
data OverLitTc
= OverLitTc {
diff --git a/compiler/hsSyn/HsPat.hs b/compiler/hsSyn/HsPat.hs
index 863f00c99b..f96858a2b3 100644
--- a/compiler/hsSyn/HsPat.hs
+++ b/compiler/hsSyn/HsPat.hs
@@ -279,7 +279,7 @@ data Pat p
-- | Trees that Grow extension point for new constructors
| XPat
(XXPat p)
-deriving instance (DataIdLR p p) => Data (Pat p)
+-- deriving instance (DataIdLR p p) => Data (Pat p)
-- ---------------------------------------------------------------------
@@ -353,7 +353,7 @@ data HsRecFields p arg -- A bunch of record fields
= HsRecFields { rec_flds :: [LHsRecField p arg],
rec_dotdot :: Maybe Int } -- Note [DotDot fields]
deriving (Functor, Foldable, Traversable)
-deriving instance (DataId p, Data arg) => Data (HsRecFields p arg)
+-- deriving instance (DataId p, Data arg) => Data (HsRecFields p arg)
-- Note [DotDot fields]
diff --git a/compiler/hsSyn/HsPat.hs-boot b/compiler/hsSyn/HsPat.hs-boot
index eb090bdd8f..3bf94eac61 100644
--- a/compiler/hsSyn/HsPat.hs-boot
+++ b/compiler/hsSyn/HsPat.hs-boot
@@ -9,14 +9,13 @@
module HsPat where
import SrcLoc( Located )
-import Data.Data hiding (Fixity)
import Outputable
-import HsExtension ( SourceTextX, DataIdLR, OutputableBndrId, GhcPass )
+import HsExtension ( SourceTextX, OutputableBndrId, GhcPass )
type role Pat nominal
data Pat (i :: *)
type LPat i = Located (Pat i)
-instance (DataIdLR p p) => Data (Pat p)
+-- instance (DataIdLR p p) => Data (Pat p)
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
=> Outputable (Pat (GhcPass p))
diff --git a/compiler/hsSyn/HsSyn.hs b/compiler/hsSyn/HsSyn.hs
index 4a3eca31c6..6bf9b04548 100644
--- a/compiler/hsSyn/HsSyn.hs
+++ b/compiler/hsSyn/HsSyn.hs
@@ -44,6 +44,7 @@ import HsImpExp
import HsLit
import PlaceHolder
import HsExtension
+import HsInstances ()
import HsPat
import HsTypes
import BasicTypes ( Fixity, WarningTxt )
@@ -111,7 +112,10 @@ data HsModule name
-- hsmodImports,hsmodDecls if this style is used.
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR name name) => Data (HsModule name)
+-- deriving instance (DataIdLR name name) => Data (HsModule name)
+deriving instance Data (HsModule GhcPs)
+deriving instance Data (HsModule GhcRn)
+deriving instance Data (HsModule GhcTc)
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
=> Outputable (HsModule (GhcPass p)) where
diff --git a/compiler/hsSyn/HsTypes.hs b/compiler/hsSyn/HsTypes.hs
index be70fe8ec8..df0e268659 100644
--- a/compiler/hsSyn/HsTypes.hs
+++ b/compiler/hsSyn/HsTypes.hs
@@ -272,7 +272,7 @@ data LHsQTyVars pass -- See Note [HsType binders]
-- See Note [Dependent LHsQTyVars] in TcHsType
}
-deriving instance (DataIdLR pass pass) => Data (LHsQTyVars pass)
+-- deriving instance (DataIdLR pass pass) => Data (LHsQTyVars pass)
mkHsQTvs :: [LHsTyVarBndr GhcPs] -> LHsQTyVars GhcPs
mkHsQTvs tvs = HsQTvs { hsq_implicit = placeHolder, hsq_explicit = tvs
@@ -302,7 +302,7 @@ data HsImplicitBndrs pass thing -- See Note [HsType binders]
-- is the payload closed? Used in
-- TcHsType.decideKindGeneralisationPlan
}
-deriving instance (DataId pass, Data thing) => Data (HsImplicitBndrs pass thing)
+-- deriving instance (DataId pass, Data thing) => Data (HsImplicitBndrs pass thing)
-- | Haskell Wildcard Binders
data HsWildCardBndrs pass thing
@@ -318,7 +318,7 @@ data HsWildCardBndrs pass thing
-- it's still there in the hsc_body.
}
-deriving instance (DataId pass, Data thing) => Data (HsWildCardBndrs pass thing)
+-- deriving instance (DataId pass, Data thing) => Data (HsWildCardBndrs pass thing)
-- | Located Haskell Signature Type
type LHsSigType pass = HsImplicitBndrs pass (LHsType pass) -- Implicit only
@@ -422,7 +422,7 @@ data HsTyVarBndr pass
| XTyVarBndr
(XXTyVarBndr pass)
-deriving instance (DataIdLR pass pass) => Data (HsTyVarBndr pass)
+-- deriving instance (DataIdLR pass pass) => Data (HsTyVarBndr pass)
type instance XUserTyVar (GhcPass _) = PlaceHolder
type instance XKindedTyVar (GhcPass _) = PlaceHolder
@@ -629,7 +629,7 @@ data HsType pass
-- For adding new constructors via Trees that Grow
| XHsType
(XXType pass)
-deriving instance (DataIdLR pass pass) => Data (HsType pass)
+-- deriving instance (DataIdLR pass pass) => Data (HsType pass)
data NewHsTypeX
= NHsCoreTy Type -- An escape hatch for tunnelling a *closed*
@@ -694,7 +694,7 @@ newtype HsWildCardInfo pass -- See Note [The wildcard story for types]
= AnonWildCard (PostRn pass (Located Name))
-- A anonymous wild card ('_'). A fresh Name is generated for
-- each individual anonymous wildcard during renaming
-deriving instance (DataId pass) => Data (HsWildCardInfo pass)
+-- deriving instance (DataId pass) => Data (HsWildCardInfo pass)
-- | Located Haskell Application Type
type LHsAppType pass = Located (HsAppType pass)
@@ -709,7 +709,7 @@ data HsAppType pass
| XAppType
(XXAppType pass)
-deriving instance (DataIdLR pass pass) => Data (HsAppType pass)
+-- deriving instance (DataIdLR pass pass) => Data (HsAppType pass)
type instance XAppInfix (GhcPass _) = PlaceHolder
type instance XAppPrefix (GhcPass _) = PlaceHolder
@@ -858,7 +858,7 @@ data ConDeclField pass -- Record fields have Haddoc docs on them
-- ^ - 'ApiAnnotation.AnnKeywordId' : 'ApiAnnotation.AnnDcolon'
-- For details on above see note [Api annotations] in ApiAnnotation
-deriving instance (DataIdLR pass pass) => Data (ConDeclField pass)
+-- deriving instance (DataIdLR pass pass) => Data (ConDeclField pass)
instance (SourceTextX (GhcPass p), OutputableBndrId (GhcPass p))
=> Outputable (ConDeclField (GhcPass p)) where
@@ -1211,7 +1211,7 @@ data FieldOcc pass = FieldOcc { extFieldOcc :: XFieldOcc pass
(XXFieldOcc pass)
deriving instance (Eq (XFieldOcc (GhcPass p))) => Eq (FieldOcc (GhcPass p))
deriving instance (Ord (XFieldOcc (GhcPass p))) => Ord (FieldOcc (GhcPass p))
-deriving instance (DataId pass) => Data (FieldOcc pass)
+-- deriving instance (DataId pass) => Data (FieldOcc pass)
type instance XFieldOcc GhcPs = PlaceHolder
type instance XFieldOcc GhcRn = Name
@@ -1242,7 +1242,7 @@ data AmbiguousFieldOcc pass
= Unambiguous (XUnambiguous pass) (Located RdrName)
| Ambiguous (XAmbiguous pass) (Located RdrName)
| XAmbiguousFieldOcc (XXAmbiguousFieldOcc pass)
-deriving instance DataId pass => Data (AmbiguousFieldOcc pass)
+-- deriving instance DataId pass => Data (AmbiguousFieldOcc pass)
type instance XUnambiguous GhcPs = PlaceHolder
type instance XUnambiguous GhcRn = Name