recursion-ninja pushed to branch wip/TTG-No-Orphans at Glasgow Haskell Compiler / GHC

Commits:

16 changed files:

Changes:

  • compiler/GHC/Core/Coercion/Axiom.hs
    1
    -{-# OPTIONS_GHC -Wno-orphans     #-} -- NFData Role
    
    1
    +{-# OPTIONS_GHC -Wno-orphans #-}
    
    2
    +{-
    
    3
    +Suppression of warnings are required for
    
    4
    +the type-class instance(s):
    
    5
    +  - NFData Role
    
    6
    +-}
    
    2 7
     
    
    3 8
     -- (c) The University of Glasgow 2012
    
    4 9
     
    

  • compiler/GHC/Core/DataCon.hs
    ... ... @@ -5,7 +5,13 @@
    5 5
     \section[DataCon]{@DataCon@: Data Constructors}
    
    6 6
     -}
    
    7 7
     
    
    8
    -{-# OPTIONS_GHC -Wno-orphans #-} -- NFData
    
    8
    +{-# OPTIONS_GHC -Wno-orphans #-}
    
    9
    +{-
    
    10
    +Suppression of warnings are required for
    
    11
    +the type-class instance(s):
    
    12
    +  - NFData SrcStrictness
    
    13
    +  - NFData SrcUnpackedness
    
    14
    +-}
    
    9 15
     
    
    10 16
     module GHC.Core.DataCon (
    
    11 17
             -- * Main data types
    

  • compiler/GHC/Hs/Decls.hs
    ... ... @@ -2,7 +2,44 @@
    2 2
     {-# LANGUAGE UndecidableInstances #-} -- Wrinkle in Note [Trees That Grow]
    
    3 3
                                           -- in module Language.Haskell.Syntax.Extension
    
    4 4
     
    
    5
    -{-# OPTIONS_GHC -Wno-orphans #-} -- Outputable
    
    5
    +{-# OPTIONS_GHC -Wno-orphans #-}
    
    6
    +{-
    
    7
    +Suppression of warnings are required for
    
    8
    +the type-class instance(s):
    
    9
    +  - Outputable (AnnDecl (GhcPass p))
    
    10
    +  - Outputable (ClsInstDecl (GhcPass p))
    
    11
    +  - Outputable (ConDecl (GhcPass p))
    
    12
    +  - Outputable (DataFamInstDecl (GhcPass p))
    
    13
    +  - Outputable (DefaultDecl (GhcPass p))
    
    14
    +  - Outputable (DerivClauseTys (GhcPass p))
    
    15
    +  - Outputable (DerivDecl (GhcPass p))
    
    16
    +  - Outputable (DerivStrategy (GhcPass p))
    
    17
    +  - Outputable (FamilyDecl (GhcPass p))
    
    18
    +  - Outputable (FamilyInfo pass)
    
    19
    +  - Outputable (ForeignDecl (GhcPass p))
    
    20
    +  - Outputable (ForeignExport (GhcPass p))
    
    21
    +  - Outputable (ForeignImport (GhcPass p))
    
    22
    +  - Outputable (FunDep (GhcPass p))
    
    23
    +  - Outputable (HsDataDefn (GhcPass p))
    
    24
    +  - Outputable (HsDecl (GhcPass p))
    
    25
    +  - Outputable (HsDerivingClause (GhcPass p))
    
    26
    +  - Outputable (HsGroup (GhcPass p))
    
    27
    +  - Outputable (InstDecl (GhcPass p))
    
    28
    +  - Outputable (RoleAnnotDecl (GhcPass p))
    
    29
    +  - Outputable (RuleDecl (GhcPass p))
    
    30
    +  - Outputable (RuleDecls (GhcPass p))
    
    31
    +  - Outputable (SpliceDecl (GhcPass p))
    
    32
    +  - Outputable SpliceDecoration
    
    33
    +  - Outputable (StandaloneKindSig (GhcPass p))
    
    34
    +  - Outputable (TyClDecl (GhcPass p))
    
    35
    +  - Outputable (TyClGroup (GhcPass p))
    
    36
    +  - Outputable (TyFamInstDecl (GhcPass p))
    
    37
    +  - Outputable (WarnDecl (GhcPass p))
    
    38
    +  - Outputable (WarnDecls (GhcPass p))
    
    39
    +and type-family instance(s):
    
    40
    +  - Anno
    
    41
    +  - X*/XX* extension points (over 50) for data-types defined in 'Language.Haskell.Syntax.Decls'
    
    42
    +-}
    
    6 43
     
    
    7 44
     {-
    
    8 45
     (c) The University of Glasgow 2006
    

  • compiler/GHC/Hs/Doc.hs
    ... ... @@ -4,6 +4,16 @@
    4 4
     {-# LANGUAGE TypeFamilies #-}
    
    5 5
     {-# LANGUAGE UndecidableInstances #-}
    
    6 6
     {-# OPTIONS_GHC -Wno-orphans #-}
    
    7
    +{-
    
    8
    +Suppression of warnings are required for
    
    9
    +the type-class instance(s):
    
    10
    +  - Binary (WithHsDocIdentifiers a GhcRn)
    
    11
    +  - Data (WithHsDocIdentifiers a pass)
    
    12
    +  - Eq (WithHsDocIdentifiers a pass)
    
    13
    +  - NFData (WithHsDocIdentifiers a pass)
    
    14
    +and type-family instance(s):
    
    15
    +  - Anno
    
    16
    +-}
    
    7 17
     
    
    8 18
     module GHC.Hs.Doc
    
    9 19
       ( HsDoc
    

  • compiler/GHC/Hs/DocString.hs
    ... ... @@ -4,7 +4,15 @@
    4 4
     {-# LANGUAGE StandaloneDeriving #-}
    
    5 5
     {-# LANGUAGE TypeFamilies #-}
    
    6 6
     {-# LANGUAGE UndecidableInstances #-}
    
    7
    -{-# OPTIONS_GHC -Wno-orphans #-} -- Data, Eq, Show, NFData
    
    7
    +{-# OPTIONS_GHC -Wno-orphans #-}
    
    8
    +{-
    
    9
    +Suppression of warnings are required for
    
    10
    +the type-class instance(s):
    
    11
    +  - Data (HsDocString pass)
    
    12
    +  - Eq (HsDocString pass)
    
    13
    +  - NFData (HsDocString (GhcPass p))
    
    14
    +  - Show (HsDocString pass)
    
    15
    +-}
    
    8 16
     
    
    9 17
     module GHC.Hs.DocString
    
    10 18
       ( LHsDocString
    

  • compiler/GHC/Hs/Extension.hs
    1 1
     {-# LANGUAGE AllowAmbiguousTypes     #-}      -- for pprIfTc, etc.
    
    2 2
     {-# LANGUAGE TypeFamilyDependencies  #-}
    
    3
    -{-# LANGUAGE UndecidableSuperClasses #-} -- for IsPass; see Note [NoGhcTc]
    
    4 3
     {-# LANGUAGE UndecidableInstances    #-} -- Wrinkle in Note [Trees That Grow]
    
    5 4
                                              -- in module Language.Haskell.Syntax.Extension
    
    6 5
     
    
    7
    -{-# OPTIONS_GHC -Wno-orphans #-} -- Outputable
    
    6
    +{-# OPTIONS_GHC -Wno-orphans #-}
    
    7
    +{-
    
    8
    +Suppression of warnings are required for
    
    9
    +the type-family instance(s):
    
    10
    +  - Anno
    
    11
    +  - IdP
    
    12
    +  - IdOccP
    
    13
    +-}
    
    8 14
     
    
    9 15
     module GHC.Hs.Extension
    
    10 16
       ( module GHC.Hs.Extension
    
    ... ... @@ -24,68 +30,6 @@ import GHC.Types.Var
    24 30
     import GHC.Utils.Outputable hiding ((<>))
    
    25 31
     import GHC.Parser.Annotation
    
    26 32
     
    
    27
    -{-
    
    28
    -Note [IsPass]
    
    29
    -~~~~~~~~~~~~~
    
    30
    -One challenge with the Trees That Grow approach
    
    31
    -is that we sometimes have different information in different passes.
    
    32
    -For example, we have
    
    33
    -
    
    34
    -  type instance XViaStrategy GhcPs = LHsSigType GhcPs
    
    35
    -  type instance XViaStrategy GhcRn = LHsSigType GhcRn
    
    36
    -  type instance XViaStrategy GhcTc = Type
    
    37
    -
    
    38
    -This means that printing a DerivStrategy (which contains an XViaStrategy)
    
    39
    -might need to print a LHsSigType, or it might need to print a type. Yet we
    
    40
    -want one Outputable instance for a DerivStrategy, instead of one per pass. We
    
    41
    -could have a large constraint, including e.g. (Outputable (XViaStrategy p),
    
    42
    -Outputable (XViaStrategy GhcTc)), and pass that around in every context where
    
    43
    -we might output a DerivStrategy. But a simpler alternative is to pass a
    
    44
    -witness to whichever pass we're in. When we pattern-match on that (GADT)
    
    45
    -witness, we learn the pass identity and can then print away. To wit, we get
    
    46
    -the definition of GhcPass and the functions isPass. These allow us to do away
    
    47
    -with big constraints, passing around all manner of dictionaries we might or
    
    48
    -might not use. It does mean that we have to manually use isPass when printing,
    
    49
    -but these places are few.
    
    50
    -
    
    51
    -See Note [NoGhcTc] about the superclass constraint to IsPass.
    
    52
    -
    
    53
    -Note [NoGhcTc]
    
    54
    -~~~~~~~~~~~~~~
    
    55
    -An expression is parsed into HsExpr GhcPs, renamed into HsExpr GhcRn, and
    
    56
    -then type-checked into HsExpr GhcTc. Not so for types! These get parsed
    
    57
    -into HsType GhcPs, renamed into HsType GhcRn, and then type-checked into
    
    58
    -Type. We never build an HsType GhcTc. Why do this? Because we need to be
    
    59
    -able to compare type-checked types for equality, and we don't want to do
    
    60
    -this with HsType.
    
    61
    -
    
    62
    -This causes wrinkles within the AST, where we normally think that the whole
    
    63
    -AST travels through the GhcPs --> GhcRn --> GhcTc pipeline as one. So we
    
    64
    -have the NoGhcTc type family, which just replaces GhcTc with GhcRn, so that
    
    65
    -user-written types can be preserved (as HsType GhcRn) even in e.g. HsExpr GhcTc.
    
    66
    -
    
    67
    -For example, this is used in ExprWithTySig:
    
    68
    -    | ExprWithTySig
    
    69
    -                (XExprWithTySig p)
    
    70
    -
    
    71
    -                (LHsExpr p)
    
    72
    -                (LHsSigWcType (NoGhcTc p))
    
    73
    -
    
    74
    -If we have (e :: ty), we still want to be able to print that (with the :: ty)
    
    75
    -after type-checking. So we retain the LHsSigWcType GhcRn, even in an
    
    76
    -HsExpr GhcTc. That's what NoGhcTc does.
    
    77
    -
    
    78
    -When we're printing the type annotation, we need to know
    
    79
    -(Outputable (LHsSigWcType GhcRn)), even though we've assumed only that
    
    80
    -(OutputableBndrId GhcTc). We thus must be able to prove OutputableBndrId (NoGhcTc p)
    
    81
    -from OutputableBndrId p. The extra constraints in OutputableBndrId and
    
    82
    -the superclass constraints of IsPass allow this. Note that the superclass
    
    83
    -constraint of IsPass is *recursive*: it asserts that IsPass (NoGhcTcPass p) holds.
    
    84
    -For this to make sense, we need -XUndecidableSuperClasses and the other constraint,
    
    85
    -saying that NoGhcTcPass is idempotent.
    
    86
    -
    
    87
    --}
    
    88
    -
    
    89 33
     type instance Anno RdrName = SrcSpanAnnN
    
    90 34
     type instance Anno Name    = SrcSpanAnnN
    
    91 35
     type instance Anno Id      = SrcSpanAnnN
    
    ... ... @@ -128,31 +72,6 @@ Bottom line: if you add a TTG extension constructor that uses DataConCantHappen,
    128 72
     sure that any uses of it as a field are strict.
    
    129 73
     -}
    
    130 74
     
    
    131
    --- | Allows us to check what phase we're in at GHC's runtime.
    
    132
    --- For example, this class allows us to write
    
    133
    ---
    
    134
    --- @
    
    135
    --- f :: forall p. IsPass p => HsExpr (GhcPass p) -> blah
    
    136
    --- f e = case ghcPass @p of
    
    137
    ---         GhcPs ->    ... in this RHS we have HsExpr GhcPs...
    
    138
    ---         GhcRn ->    ... in this RHS we have HsExpr GhcRn...
    
    139
    ---         GhcTc ->    ... in this RHS we have HsExpr GhcTc...
    
    140
    --- @
    
    141
    ---
    
    142
    --- which is very useful, for example, when pretty-printing.
    
    143
    --- See Note [IsPass].
    
    144
    -class ( NoGhcTcPass (NoGhcTcPass p) ~ NoGhcTcPass p
    
    145
    -      , IsPass (NoGhcTcPass p)
    
    146
    -      ) => IsPass p where
    
    147
    -  ghcPass :: GhcPass p
    
    148
    -
    
    149
    -instance IsPass 'Parsed where
    
    150
    -  ghcPass = GhcPs
    
    151
    -instance IsPass 'Renamed where
    
    152
    -  ghcPass = GhcRn
    
    153
    -instance IsPass 'Typechecked where
    
    154
    -  ghcPass = GhcTc
    
    155
    -
    
    156 75
     type instance IdP (GhcPass p) = IdGhcP p
    
    157 76
     
    
    158 77
     -- | Maps the "normal" id type for a given GHC pass
    
    ... ... @@ -171,20 +90,9 @@ type family IdOccGhcP pass where
    171 90
       IdOccGhcP 'Typechecked = Id
    
    172 91
     type LIdOccGhcP p = XRecGhc (IdOccGhcP p)
    
    173 92
     
    
    174
    --- | Marks that a field uses the GhcRn variant even when the pass
    
    175
    --- parameter is GhcTc. Useful for storing HsTypes in GHC.Hs.Exprs, say, because
    
    176
    --- HsType GhcTc should never occur.
    
    177
    --- See Note [NoGhcTc]
    
    178
    -
    
    179
    --- Breaking it up this way, GHC can figure out that the result is a GhcPass
    
    180
    -type instance NoGhcTc (GhcPass pass) = GhcPass (NoGhcTcPass pass)
    
    181
    -
    
    182
    -type family NoGhcTcPass (p :: Pass) :: Pass where
    
    183
    -  NoGhcTcPass 'Typechecked = 'Renamed
    
    184
    -  NoGhcTcPass other        = other
    
    185
    -
    
    186 93
     -- |Constraint type to bundle up the requirement for 'OutputableBndr' on both
    
    187
    --- the @id@ and the 'NoGhcTc' of it. See Note [NoGhcTc].
    
    94
    +-- the @id@ and the 'NoGhcTc' of it.
    
    95
    +-- See Note [NoGhcTc] in "GHC.Hs.Extension.GhcPass".
    
    188 96
     type OutputableBndrId pass =
    
    189 97
       ( OutputableBndr (IdGhcP pass)
    
    190 98
       , OutputableBndr (IdOccGhcP pass)
    
    ... ... @@ -209,11 +117,3 @@ pprIfRn pp = case ghcPass @p of GhcRn -> pp
    209 117
     pprIfTc :: forall p. IsPass p => (p ~ 'Typechecked => SDoc) -> SDoc
    
    210 118
     pprIfTc pp = case ghcPass @p of GhcTc -> pp
    
    211 119
                                     _     -> empty
    212
    -
    
    213
    ---- Outputable
    
    214
    -
    
    215
    -instance Outputable NoExtField where
    
    216
    -  ppr _ = text "NoExtField"
    
    217
    -
    
    218
    -instance Outputable DataConCantHappen where
    
    219
    -  ppr = dataConCantHappen

  • compiler/GHC/Hs/Extension/GhcPass.hs
    ... ... @@ -2,10 +2,14 @@
    2 2
     {-# LANGUAGE GADTs #-}
    
    3 3
     {-# LANGUAGE KindSignatures #-}
    
    4 4
     {-# LANGUAGE TypeFamilies #-}
    
    5
    +{-# LANGUAGE UndecidableSuperClasses #-}
    
    5 6
     
    
    6 7
     {-# OPTIONS_GHC -Wno-orphans #-}
    
    7
    --- The above is required for the type-family instances:
    
    8
    ---   * Anno HsDocStringChunk = SrcSpan
    
    8
    +{-
    
    9
    +Suppression of warnings are required for
    
    10
    +the type-family instance(s):
    
    11
    +  - Anno HsDocStringChunk
    
    12
    +-}
    
    9 13
     
    
    10 14
     module GHC.Hs.Extension.GhcPass where
    
    11 15
     
    
    ... ... @@ -39,6 +43,105 @@ type GhcPs = GhcPass 'Parsed -- Output of parser
    39 43
     type GhcRn   = GhcPass 'Renamed     -- Output of renamer
    
    40 44
     type GhcTc   = GhcPass 'Typechecked -- Output of typechecker
    
    41 45
     
    
    46
    +{-
    
    47
    +Note [IsPass]
    
    48
    +~~~~~~~~~~~~~
    
    49
    +One challenge with the Trees That Grow approach
    
    50
    +is that we sometimes have different information in different passes.
    
    51
    +For example, we have
    
    52
    +
    
    53
    +  type instance XViaStrategy GhcPs = LHsSigType GhcPs
    
    54
    +  type instance XViaStrategy GhcRn = LHsSigType GhcRn
    
    55
    +  type instance XViaStrategy GhcTc = Type
    
    56
    +
    
    57
    +This means that printing a DerivStrategy (which contains an XViaStrategy)
    
    58
    +might need to print a LHsSigType, or it might need to print a type. Yet we
    
    59
    +want one Outputable instance for a DerivStrategy, instead of one per pass. We
    
    60
    +could have a large constraint, including e.g. (Outputable (XViaStrategy p),
    
    61
    +Outputable (XViaStrategy GhcTc)), and pass that around in every context where
    
    62
    +we might output a DerivStrategy. But a simpler alternative is to pass a
    
    63
    +witness to whichever pass we're in. When we pattern-match on that (GADT)
    
    64
    +witness, we learn the pass identity and can then print away. To wit, we get
    
    65
    +the definition of GhcPass and the functions isPass. These allow us to do away
    
    66
    +with big constraints, passing around all manner of dictionaries we might or
    
    67
    +might not use. It does mean that we have to manually use isPass when printing,
    
    68
    +but these places are few.
    
    69
    +
    
    70
    +See Note [NoGhcTc] about the superclass constraint to IsPass.
    
    71
    +
    
    72
    +Note [NoGhcTc]
    
    73
    +~~~~~~~~~~~~~~
    
    74
    +An expression is parsed into HsExpr GhcPs, renamed into HsExpr GhcRn, and
    
    75
    +then type-checked into HsExpr GhcTc. Not so for types! These get parsed
    
    76
    +into HsType GhcPs, renamed into HsType GhcRn, and then type-checked into
    
    77
    +Type. We never build an HsType GhcTc. Why do this? Because we need to be
    
    78
    +able to compare type-checked types for equality, and we don't want to do
    
    79
    +this with HsType.
    
    80
    +
    
    81
    +This causes wrinkles within the AST, where we normally think that the whole
    
    82
    +AST travels through the GhcPs --> GhcRn --> GhcTc pipeline as one. So we
    
    83
    +have the NoGhcTc type family, which just replaces GhcTc with GhcRn, so that
    
    84
    +user-written types can be preserved (as HsType GhcRn) even in e.g. HsExpr GhcTc.
    
    85
    +
    
    86
    +For example, this is used in ExprWithTySig:
    
    87
    +    | ExprWithTySig
    
    88
    +                (XExprWithTySig p)
    
    89
    +
    
    90
    +                (LHsExpr p)
    
    91
    +                (LHsSigWcType (NoGhcTc p))
    
    92
    +
    
    93
    +If we have (e :: ty), we still want to be able to print that (with the :: ty)
    
    94
    +after type-checking. So we retain the LHsSigWcType GhcRn, even in an
    
    95
    +HsExpr GhcTc. That's what NoGhcTc does.
    
    96
    +
    
    97
    +When we're printing the type annotation, we need to know
    
    98
    +(Outputable (LHsSigWcType GhcRn)), even though we've assumed only that
    
    99
    +(OutputableBndrId GhcTc). We thus must be able to prove OutputableBndrId (NoGhcTc p)
    
    100
    +from OutputableBndrId p. The extra constraints in OutputableBndrId and
    
    101
    +the superclass constraints of IsPass allow this. Note that the superclass
    
    102
    +constraint of IsPass is *recursive*: it asserts that IsPass (NoGhcTcPass p) holds.
    
    103
    +For this to make sense, we need -XUndecidableSuperClasses and the other constraint,
    
    104
    +saying that NoGhcTcPass is idempotent.
    
    105
    +
    
    106
    +-}
    
    107
    +
    
    108
    +-- | Allows us to check what phase we're in at GHC's runtime.
    
    109
    +-- For example, this class allows us to write
    
    110
    +--
    
    111
    +-- @
    
    112
    +-- f :: forall p. IsPass p => HsExpr (GhcPass p) -> blah
    
    113
    +-- f e = case ghcPass @p of
    
    114
    +--         GhcPs ->    ... in this RHS we have HsExpr GhcPs...
    
    115
    +--         GhcRn ->    ... in this RHS we have HsExpr GhcRn...
    
    116
    +--         GhcTc ->    ... in this RHS we have HsExpr GhcTc...
    
    117
    +-- @
    
    118
    +--
    
    119
    +-- which is very useful, for example, when pretty-printing.
    
    120
    +-- See Note [IsPass].
    
    121
    +class ( NoGhcTcPass (NoGhcTcPass p) ~ NoGhcTcPass p
    
    122
    +      , IsPass (NoGhcTcPass p)
    
    123
    +      ) => IsPass p where
    
    124
    +  ghcPass :: GhcPass p
    
    125
    +
    
    126
    +instance IsPass 'Parsed where
    
    127
    +  ghcPass = GhcPs
    
    128
    +instance IsPass 'Renamed where
    
    129
    +  ghcPass = GhcRn
    
    130
    +instance IsPass 'Typechecked where
    
    131
    +  ghcPass = GhcTc
    
    132
    +
    
    133
    +-- | Marks that a field uses the GhcRn variant even when the pass
    
    134
    +-- parameter is GhcTc. Useful for storing HsTypes in GHC.Hs.Exprs, say, because
    
    135
    +-- HsType GhcTc should never occur.
    
    136
    +-- See Note [NoGhcTc]
    
    137
    +
    
    138
    +-- Breaking it up this way, GHC can figure out that the result is a GhcPass
    
    139
    +type instance NoGhcTc (GhcPass pass) = GhcPass (NoGhcTcPass pass)
    
    140
    +
    
    141
    +type family NoGhcTcPass (p :: Pass) :: Pass where
    
    142
    +  NoGhcTcPass 'Typechecked = 'Renamed
    
    143
    +  NoGhcTcPass other        = other
    
    144
    +
    
    42 145
     -- See Note [XRec and Anno in the AST] in GHC.Parser.Annotation
    
    43 146
     type instance XRec (GhcPass p) a = XRecGhc a
    
    44 147
     
    

  • compiler/GHC/Hs/ImpExp.hs
    1
    -{-# OPTIONS_GHC -Wno-orphans      #-} -- Outputable and IEWrappedName
    
    1
    +{-# OPTIONS_GHC -Wno-orphans #-}
    
    2
    +{-
    
    3
    +Suppression of warnings are required for
    
    4
    +the type-class instance(s):
    
    5
    +  - Data (IEWrappedName GhcPs)
    
    6
    +  - Data (IEWrappedName GhcRn)
    
    7
    +  - Data (IEWrappedName GhcTc)
    
    8
    +  - Data (NamespaceSpecifier GhcPs)
    
    9
    +  - Data (NamespaceSpecifier GhcRn)
    
    10
    +  - Data (NamespaceSpecifier GhcTc)
    
    11
    +  - Eq (IEWrappedName GhcPs)
    
    12
    +  - Eq (IEWrappedName GhcRn)
    
    13
    +  - Eq (IEWrappedName GhcTc)
    
    14
    +  - Eq (NamespaceSpecifier GhcPs)
    
    15
    +  - Eq (NamespaceSpecifier GhcRn)
    
    16
    +  - Eq (NamespaceSpecifier GhcTc)
    
    17
    +  - HasOccName (IEWrappedName (GhcPass p))
    
    18
    +  - Outputable (IE (GhcPass p))
    
    19
    +  - Outputable (IEWrappedName (GhcPass p))
    
    20
    +  - Outputable (ImportDecl (GhcPass p))
    
    21
    +  - OutputableBndr (IEWrappedName (GhcPass p))
    
    22
    +and type-family instance(s):
    
    23
    +  - Anno
    
    24
    +  - ImportDeclPkgQual
    
    25
    +  - XCImportDecl
    
    26
    +  - XDataNamespaceSpecifier
    
    27
    +  - XIEData
    
    28
    +  - XIEDefault
    
    29
    +  - XIEDoc
    
    30
    +  - XIEDocNamed
    
    31
    +  - XIEGroup
    
    32
    +  - XIEModuleContents
    
    33
    +  - XIEName
    
    34
    +  - XIEPattern
    
    35
    +  - XIEThingAbs
    
    36
    +  - XIEThingAll
    
    37
    +  - XIEThingWith
    
    38
    +  - XIEType
    
    39
    +  - XIEVar
    
    40
    +  - XIEWholeNamespace
    
    41
    +  - XNoNamespaceSpecifier
    
    42
    +  - XTypeNamespaceSpecifier
    
    43
    +  - XXIE
    
    44
    +  - XXIEWrappedName
    
    45
    +  - XXImportDecl
    
    46
    +  - XXNamespaceSpecifier
    
    47
    +-}
    
    2 48
     {-# LANGUAGE TypeFamilies         #-}
    
    3 49
     {-# LANGUAGE UndecidableInstances #-} -- Wrinkle in Note [Trees That Grow]
    
    4 50
                                           -- in module Language.Haskell.Syntax.Extension
    

  • compiler/GHC/Hs/Specificity.hs deleted
    1
    -{-# OPTIONS_GHC -Wno-orphans #-} -- NFData
    
    2
    -module GHC.Hs.Specificity where
    
    3
    -
    
    4
    -import Control.DeepSeq (NFData(..))
    
    5
    -
    
    6
    -import Language.Haskell.Syntax.Specificity
    
    7
    -
    
    8
    -{- *********************************************************************
    
    9
    -*                                                                      *
    
    10
    -*                   ForAllTyFlag
    
    11
    -*                                                                      *
    
    12
    -********************************************************************* -}
    
    13
    -
    
    14
    -instance NFData Specificity where
    
    15
    -  rnf SpecifiedSpec = ()
    
    16
    -  rnf InferredSpec = ()
    
    17
    -instance NFData ForAllTyFlag where
    
    18
    -  rnf (Invisible spec) = rnf spec
    
    19
    -  rnf Required = ()

  • compiler/GHC/Hs/Type.hs
    1 1
     {-# LANGUAGE TypeFamilies #-}
    
    2 2
     {-# LANGUAGE ViewPatterns #-}
    
    3 3
     {-# LANGUAGE UndecidableInstances #-} -- Wrinkle in Note [Trees That Grow]
    
    4
    -                                       -- in module Language.Haskell.Syntax.Extension
    
    5
    -
    
    6
    -{-# OPTIONS_GHC -Wno-orphans #-} -- NamedThing, Outputable, OutputableBndrId
    
    4
    +                                      -- in module Language.Haskell.Syntax.Extension
    
    5
    +{-# OPTIONS_GHC -Wno-orphans #-}
    
    6
    +{-
    
    7
    +Suppression of warnings are required for
    
    8
    +the type-class instance(s):
    
    9
    +  - Outputable (FieldOcc (GhcPass p))
    
    10
    +  - Outputable (HsArg (GhcPass p) tm ty)
    
    11
    +  - Outputable (HsBndrVar (GhcPass p))
    
    12
    +  - Outputable (HsConDeclRecField (GhcPass p))
    
    13
    +  - Outputable (HsConDetails (GhcPass p) arg rec)
    
    14
    +  - Outputable (HsContextDetails (GhcPass p) arg)
    
    15
    +  - Outputable (HsForAllTelescope (GhcPass p))
    
    16
    +  - Outputable (HsOuterTyVarBndrs flag (GhcPass p))
    
    17
    +  - Outputable (HsPatSigType (GhcPass p))
    
    18
    +  - Outputable (HsSigType (GhcPass p))
    
    19
    +  - Outputable (HsTyPat (GhcPass p))
    
    20
    +  - Outputable (HsTyVarBndr flag (GhcPass p))
    
    21
    +  - Outputable (HsType (GhcPass p))
    
    22
    +  - Outputable (HsWildCardBndrs (GhcPass p) thing)
    
    23
    +  - Outputable (LHsQTyVars (GhcPass p))
    
    24
    +  - OutputableBndr (FieldOcc (GhcPass pass))
    
    25
    +  - OutputableBndr (GenLocated SrcSpan (FieldOcc (GhcPass pass)))
    
    26
    +and type-family instance(s):
    
    27
    +  - Anno
    
    28
    +  - X*/XX* extension points (over 50) for data-types defined in 'Language.Haskell.Syntax.Type'
    
    29
    +-}
    
    7 30
     
    
    8 31
     {-
    
    9 32
     (c) The University of Glasgow 2006
    

  • compiler/GHC/Types/Hint/Ppr.hs
    1 1
     {-# LANGUAGE OverloadedStrings #-}
    
    2 2
     
    
    3
    -{-# OPTIONS_GHC -Wno-orphans #-}   {- instance Outputable GhcHint -}
    
    3
    +{-# OPTIONS_GHC -Wno-orphans #-}
    
    4
    +{-
    
    5
    +Suppression of warnings are required for
    
    6
    +the type-class instance(s):
    
    7
    +  - Outputable GhcHint
    
    8
    +-}
    
    4 9
     
    
    5 10
     module GHC.Types.Hint.Ppr (
    
    6 11
       perhapsAsPat, pprSigLike
    

  • compiler/GHC/Types/InlinePragma.hs
    ... ... @@ -10,13 +10,13 @@
    10 10
     
    
    11 11
     {-# OPTIONS_GHC -Wno-orphans #-}
    
    12 12
     {-
    
    13
    -Suppression of warnings are required for instances:
    
    14
    -  - Binary Activation
    
    15
    -  - Binary CompilerPhase
    
    16
    -  - Binary InlineSaturation
    
    17
    -  - Binary XActivation
    
    18
    -  - Binary XInlinePragmaGhc
    
    19
    -  - Outputable CompilerPhase
    
    13
    +Suppression of warnings are required for
    
    14
    +the type-class instance(s):
    
    15
    +  - Outputable (InlinePragma (GhcPass p))
    
    16
    +and type-family instance(s):
    
    17
    +  - XInlinePragma
    
    18
    +  - XXInlinePragma
    
    19
    +  - XXActivation
    
    20 20
     -}
    
    21 21
     
    
    22 22
     module GHC.Types.InlinePragma
    

  • compiler/GHC/Types/Var.hs
    ... ... @@ -129,7 +129,6 @@ import GHC.Utils.Binary
    129 129
     import GHC.Utils.Outputable
    
    130 130
     import GHC.Utils.Panic
    
    131 131
     
    
    132
    -import GHC.Hs.Specificity ()
    
    133 132
     import Language.Haskell.Syntax.Specificity
    
    134 133
     import Control.DeepSeq
    
    135 134
     
    

  • compiler/GHC/Utils/Outputable.hs
    ... ... @@ -123,6 +123,8 @@ import Language.Haskell.Syntax.Decls.Foreign
    123 123
       ( CCallConv(..), CExportSpec(..), Safety(..) )
    
    124 124
     import Language.Haskell.Syntax.Decls.Overlap ( OverlapMode(..) )
    
    125 125
     import Language.Haskell.Syntax.Doc
    
    126
    +import Language.Haskell.Syntax.Extension
    
    127
    +  ( DataConCantHappen, NoExtField, dataConCantHappen )
    
    126 128
     import Language.Haskell.Syntax.ImpExp ( NamespaceSpecifier(..) )
    
    127 129
     import Language.Haskell.Syntax.Module.Name ( ModuleName(..) )
    
    128 130
     import Language.Haskell.Syntax.Specificity
    
    ... ... @@ -1116,6 +1118,12 @@ instance Outputable Serialized where
    1116 1118
     instance Outputable Extension where
    
    1117 1119
         ppr = text . show
    
    1118 1120
     
    
    1121
    +instance Outputable NoExtField where
    
    1122
    +  ppr _ = text "NoExtField"
    
    1123
    +
    
    1124
    +instance Outputable DataConCantHappen where
    
    1125
    +  ppr = dataConCantHappen
    
    1126
    +
    
    1119 1127
     instance Outputable ModuleName where
    
    1120 1128
       ppr = pprModuleName
    
    1121 1129
     
    

  • compiler/Language/Haskell/Syntax/Specificity.hs
    ... ... @@ -14,6 +14,7 @@ module Language.Haskell.Syntax.Specificity (
    14 14
     
    
    15 15
     import Prelude
    
    16 16
     
    
    17
    +import Control.DeepSeq (NFData(..))
    
    17 18
     import Data.Data
    
    18 19
     
    
    19 20
     -- | ForAllTyFlag
    
    ... ... @@ -42,6 +43,14 @@ pattern Specified = Invisible SpecifiedSpec
    42 43
     
    
    43 44
     {-# COMPLETE Required, Specified, Inferred #-}
    
    44 45
     
    
    46
    +instance NFData Specificity where
    
    47
    +  rnf SpecifiedSpec = ()
    
    48
    +  rnf InferredSpec = ()
    
    49
    +
    
    50
    +instance NFData ForAllTyFlag where
    
    51
    +  rnf (Invisible spec) = rnf spec
    
    52
    +  rnf Required = ()
    
    53
    +
    
    45 54
     -- | Does this 'ForAllTyFlag' classify an argument that is written in Haskell?
    
    46 55
     isVisibleForAllTyFlag :: ForAllTyFlag -> Bool
    
    47 56
     isVisibleForAllTyFlag af = not (isInvisibleForAllTyFlag af)
    

  • compiler/ghc.cabal.in
    ... ... @@ -566,7 +566,6 @@ Library
    566 566
             GHC.Hs.Instances
    
    567 567
             GHC.Hs.Lit
    
    568 568
             GHC.Hs.Pat
    
    569
    -        GHC.Hs.Specificity
    
    570 569
             GHC.Hs.Stats
    
    571 570
             GHC.HsToCore
    
    572 571
             GHC.HsToCore.Arrows