recursion-ninja pushed to branch wip/26699 at Glasgow Haskell Compiler / GHC

Commits:

18 changed files:

Changes:

  • compiler/GHC/Hs/Decls.hs
    ... ... @@ -17,7 +17,7 @@ module GHC.Hs.Decls (
    17 17
       -- * Toplevel declarations
    
    18 18
       HsDecl(..), LHsDecl, HsDataDefn(..), HsDeriving, LHsFunDep,
    
    19 19
       HsDerivingClause(..), LHsDerivingClause, DerivClauseTys(..), LDerivClauseTys,
    
    20
    -  NewOrData, newOrDataToFlavour, anyLConIsGadt,
    
    20
    +  NewOrData, newOrDataToFlavour, dataDefnConsNewOrData, anyLConIsGadt,
    
    21 21
       StandaloneKindSig(..), LStandaloneKindSig, standaloneKindSigName,
    
    22 22
     
    
    23 23
       -- ** Class or type declarations
    
    ... ... @@ -1106,6 +1106,11 @@ anyLConIsGadt xs = case toList xs of
    1106 1106
     {-# SPECIALIZE anyLConIsGadt :: [GenLocated l (ConDecl pass)] -> Bool #-}
    
    1107 1107
     {-# SPECIALIZE anyLConIsGadt :: DataDefnCons (GenLocated l (ConDecl pass)) -> Bool #-}
    
    1108 1108
     
    
    1109
    +dataDefnConsNewOrData :: DataDefnCons a -> NewOrData
    
    1110
    +dataDefnConsNewOrData = \ case
    
    1111
    +    NewTypeCon   {} -> NewType
    
    1112
    +    DataTypeCons {} -> DataType
    
    1113
    +
    
    1109 1114
     {-
    
    1110 1115
     ************************************************************************
    
    1111 1116
     *                                                                      *
    

  • compiler/GHC/Hs/Utils.hs
    ... ... @@ -53,6 +53,7 @@ module GHC.Hs.Utils(
    53 53
       -- * Bindings
    
    54 54
       mkFunBind, mkVarBind, mkHsVarBind, mkSimpleGeneratedFunBind, mkTopFunBind,
    
    55 55
       mkPatSynBind,
    
    56
    +  familyInfoTyConFlavour,
    
    56 57
       isInfixFunBind,
    
    57 58
       spanHsLocaLBinds,
    
    58 59
     
    
    ... ... @@ -148,6 +149,7 @@ import Control.Arrow ( first )
    148 149
     import Data.Foldable ( toList )
    
    149 150
     import Data.List ( partition )
    
    150 151
     import Data.List.NonEmpty ( NonEmpty (..), nonEmpty )
    
    152
    +import Data.Maybe ( isNothing )
    
    151 153
     import qualified Data.List.NonEmpty as NE
    
    152 154
     
    
    153 155
     import Data.IntMap ( IntMap )
    
    ... ... @@ -1502,6 +1504,18 @@ hsLTyClDeclBinders (L loc (DataDecl { tcdLName = (L _ name)
    1502 1504
       where
    
    1503 1505
         flav = newOrDataToFlavour $ dataDefnConsNewOrData $ dd_cons defn
    
    1504 1506
     
    
    1507
    +familyInfoTyConFlavour
    
    1508
    +  :: Maybe tc    -- ^ Just cls <=> this is an associated family of class cls
    
    1509
    +  -> FamilyInfo pass
    
    1510
    +  -> TyConFlavour tc
    
    1511
    +familyInfoTyConFlavour mb_parent_tycon info =
    
    1512
    +  case info of
    
    1513
    +    DataFamily         -> OpenFamilyFlavour (IAmData DataType) mb_parent_tycon
    
    1514
    +    OpenTypeFamily     -> OpenFamilyFlavour IAmType mb_parent_tycon
    
    1515
    +    ClosedTypeFamily _ -> assert (isNothing mb_parent_tycon)
    
    1516
    +                          -- See Note [Closed type family mb_parent_tycon]
    
    1517
    +                          ClosedTypeFamilyFlavour
    
    1518
    +
    
    1505 1519
     -------------------
    
    1506 1520
     hsForeignDeclsBinders :: forall p a. (UnXRec (GhcPass p), IsSrcSpanAnn p a)
    
    1507 1521
                           => [LForeignDecl (GhcPass p)] -> [LIdP (GhcPass p)]
    

  • compiler/GHC/HsToCore/Errors/Types.hs
    ... ... @@ -4,7 +4,7 @@ module GHC.HsToCore.Errors.Types where
    4 4
     
    
    5 5
     import GHC.Prelude
    
    6 6
     
    
    7
    -import GHC.Core (CoreRule, CoreExpr, RuleName)
    
    7
    +import GHC.Core (CoreRule, CoreExpr)
    
    8 8
     import GHC.Core.DataCon
    
    9 9
     import GHC.Core.ConLike
    
    10 10
     import GHC.Core.Type
    

  • compiler/GHC/Rename/Env.hs
    ... ... @@ -80,7 +80,7 @@ import GHC.Core.ConLike
    80 80
     import GHC.Core.DataCon
    
    81 81
     import GHC.Core.TyCon
    
    82 82
     import GHC.Builtin.Names( rOOT_MAIN )
    
    83
    -import GHC.Types.Basic  ( TopLevelFlag(..), TupleSort(..), tupleSortBoxity )
    
    83
    +import GHC.Types.Basic  ( TupleSort(..), tupleSortBoxity )
    
    84 84
     import GHC.Types.TyThing ( tyThingGREInfo )
    
    85 85
     import GHC.Types.SrcLoc as SrcLoc
    
    86 86
     import GHC.Utils.Outputable as Outputable
    

  • compiler/GHC/Rename/Module.hs
    ... ... @@ -52,7 +52,7 @@ import GHC.Types.ForeignCall ( CCallTarget(..) )
    52 52
     import GHC.Types.Name
    
    53 53
     import GHC.Types.Name.Set
    
    54 54
     import GHC.Types.Name.Env
    
    55
    -import GHC.Types.Basic  ( VisArity, TyConFlavour(..), TypeOrKind(..), RuleName )
    
    55
    +import GHC.Types.Basic  ( VisArity,  TyConFlavour(..), TypeOrKind(..) )
    
    56 56
     import GHC.Types.GREInfo (ConLikeInfo (..), ConInfo, mkConInfo, conInfoFields)
    
    57 57
     import GHC.Types.Hint (SigLike(..))
    
    58 58
     import GHC.Types.Unique.Set
    

  • compiler/GHC/Rename/Names.hs
    ... ... @@ -70,7 +70,7 @@ import GHC.Types.FieldLabel
    70 70
     import GHC.Types.Hint
    
    71 71
     import GHC.Types.SourceFile
    
    72 72
     import GHC.Types.SrcLoc as SrcLoc
    
    73
    -import GHC.Types.Basic  ( TopLevelFlag(..), TyConFlavour (..), convImportLevel )
    
    73
    +import GHC.Types.Basic  ( TyConFlavour (..), convImportLevel )
    
    74 74
     import GHC.Types.SourceText
    
    75 75
     import GHC.Types.Id
    
    76 76
     import GHC.Types.PkgQual
    

  • compiler/GHC/Rename/Splice.hs
    ... ... @@ -32,7 +32,7 @@ import GHC.Rename.Unbound ( isUnboundName )
    32 32
     import GHC.Rename.Module  ( rnSrcDecls, findSplice )
    
    33 33
     import GHC.Rename.Pat     ( rnPat )
    
    34 34
     import GHC.Types.Error
    
    35
    -import GHC.Types.Basic    ( TopLevelFlag, isTopLevel, maxPrec )
    
    35
    +import GHC.Types.Basic    ( maxPrec )
    
    36 36
     import GHC.Types.SourceText ( SourceText(..) )
    
    37 37
     import GHC.Types.ThLevelIndex
    
    38 38
     import GHC.Utils.Outputable
    

  • compiler/GHC/Tc/Gen/Head.hs
    ... ... @@ -62,7 +62,6 @@ import GHC.Types.Id
    62 62
     import GHC.Types.Name
    
    63 63
     import GHC.Types.Name.Reader
    
    64 64
     import GHC.Types.SrcLoc
    
    65
    -import GHC.Types.Basic
    
    66 65
     import GHC.Types.Error
    
    67 66
     
    
    68 67
     import GHC.Builtin.Names
    

  • compiler/GHC/Tc/Utils/Env.hs
    ... ... @@ -119,7 +119,6 @@ import GHC.Data.List.SetOps
    119 119
     import GHC.Data.Maybe( MaybeErr(..), orElse, maybeToList, fromMaybe )
    
    120 120
     
    
    121 121
     import GHC.Types.SrcLoc
    
    122
    -import GHC.Types.Basic hiding( SuccessFlag(..) )
    
    123 122
     import GHC.Types.TypeEnv
    
    124 123
     import GHC.Types.SourceFile
    
    125 124
     import GHC.Types.Name
    

  • compiler/GHC/Tc/Utils/Monad.hs
    ... ... @@ -239,7 +239,7 @@ import GHC.Types.Unique.DFM
    239 239
     import GHC.Types.Unique.Supply
    
    240 240
     import GHC.Types.Unique (uniqueTag)
    
    241 241
     import GHC.Types.Annotations
    
    242
    -import GHC.Types.Basic( TopLevelFlag(..), TypeOrKind(..) )
    
    242
    +import GHC.Types.Basic( TypeOrKind(..) )
    
    243 243
     import GHC.Types.CostCentre.State
    
    244 244
     import GHC.Types.SourceFile
    
    245 245
     
    

  • compiler/GHC/Types/Basic.hs
    ... ... @@ -103,7 +103,6 @@ module GHC.Types.Basic (
    103 103
     import GHC.Prelude
    
    104 104
     
    
    105 105
     import GHC.ForeignSrcLang
    
    106
    -import GHC.Data.FastString
    
    107 106
     import GHC.Utils.Outputable
    
    108 107
     import GHC.Utils.Panic
    
    109 108
     import GHC.Utils.Binary
    
    ... ... @@ -111,15 +110,16 @@ import GHC.Types.Arity
    111 110
     import GHC.Types.SourceText
    
    112 111
     import qualified GHC.LanguageExtensions as LangExt
    
    113 112
     import {-# SOURCE #-} Language.Haskell.Syntax.Type (PromotionFlag(..), isPromoted)
    
    114
    -import Language.Haskell.Syntax.Basic (Boxity(..), isBoxed, ConTag)
    
    115 113
     import {-# SOURCE #-} Language.Haskell.Syntax.Expr (HsDoFlavour)
    
    114
    +
    
    115
    +import Language.Haskell.Syntax.Basic
    
    116
    +import Language.Haskell.Syntax.ImpExp
    
    117
    +
    
    116 118
     import Control.DeepSeq ( NFData(..) )
    
    117 119
     import Data.Data
    
    118 120
     import Data.Maybe
    
    119 121
     import qualified Data.Semigroup as Semi
    
    120 122
     
    
    121
    -import Language.Haskell.Syntax.ImpExp
    
    122
    -
    
    123 123
     {-
    
    124 124
     ************************************************************************
    
    125 125
     *                                                                      *
    
    ... ... @@ -420,55 +420,10 @@ instance NFData FunctionOrData where
    420 420
     ************************************************************************
    
    421 421
     -}
    
    422 422
     
    
    423
    -type RuleName = FastString
    
    424
    -
    
    425 423
     pprRuleName :: RuleName -> SDoc
    
    426 424
     pprRuleName rn = doubleQuotes (ftext rn)
    
    427 425
     
    
    428 426
     
    
    429
    -{-
    
    430
    -************************************************************************
    
    431
    -*                                                                      *
    
    432
    -\subsection[Top-level/local]{Top-level/not-top level flag}
    
    433
    -*                                                                      *
    
    434
    -************************************************************************
    
    435
    --}
    
    436
    -
    
    437
    -data TopLevelFlag
    
    438
    -  = TopLevel
    
    439
    -  | NotTopLevel
    
    440
    -  deriving Data
    
    441
    -
    
    442
    -isTopLevel, isNotTopLevel :: TopLevelFlag -> Bool
    
    443
    -
    
    444
    -isNotTopLevel NotTopLevel = True
    
    445
    -isNotTopLevel TopLevel    = False
    
    446
    -
    
    447
    -isTopLevel TopLevel     = True
    
    448
    -isTopLevel NotTopLevel  = False
    
    449
    -
    
    450
    -instance Outputable TopLevelFlag where
    
    451
    -  ppr TopLevel    = text "<TopLevel>"
    
    452
    -  ppr NotTopLevel = text "<NotTopLevel>"
    
    453
    -
    
    454
    -{-
    
    455
    -************************************************************************
    
    456
    -*                                                                      *
    
    457
    -                Boxity flag
    
    458
    -*                                                                      *
    
    459
    -************************************************************************
    
    460
    --}
    
    461
    -
    
    462
    -instance Outputable Boxity where
    
    463
    -  ppr Boxed   = text "Boxed"
    
    464
    -  ppr Unboxed = text "Unboxed"
    
    465
    -
    
    466
    -instance Binary Boxity where -- implemented via isBoxed-isomorphism to Bool
    
    467
    -  put_ bh = put_ bh . isBoxed
    
    468
    -  get bh  = do
    
    469
    -    b <- get bh
    
    470
    -    pure $ if b then Boxed else Unboxed
    
    471
    -
    
    472 427
     {-
    
    473 428
     ************************************************************************
    
    474 429
     *                                                                      *
    
    ... ... @@ -1524,11 +1479,13 @@ instance NFData TypeOrConstraint where
    1524 1479
         TypeLike -> ()
    
    1525 1480
         ConstraintLike -> ()
    
    1526 1481
     
    
    1527
    -{- *********************************************************************
    
    1482
    +{-
    
    1483
    +************************************************************************
    
    1528 1484
     *                                                                      *
    
    1529
    -                          TyConFlavour
    
    1485
    +TyConFlavour
    
    1530 1486
     *                                                                      *
    
    1531
    -********************************************************************* -}
    
    1487
    +************************************************************************
    
    1488
    +-}
    
    1532 1489
     
    
    1533 1490
     -- | Paints a picture of what a 'TyCon' represents, in broad strokes.
    
    1534 1491
     -- This is used towards more informative error messages.
    
    ... ... @@ -1571,7 +1528,6 @@ instance Outputable (TyConFlavour tc) where
    1571 1528
           go BuiltInTypeFlavour      = "built-in type"
    
    1572 1529
           go PromotedDataConFlavour  = "promoted data constructor"
    
    1573 1530
     
    
    1574
    -
    
    1575 1531
     -- | Get the enclosing class TyCon (if there is one) for the given TyConFlavour
    
    1576 1532
     tyConFlavourAssoc_maybe :: TyConFlavour tc -> Maybe tc
    
    1577 1533
     tyConFlavourAssoc_maybe (OpenFamilyFlavour _ mb_parent) = mb_parent
    
    ... ... @@ -1584,22 +1540,10 @@ data TypeOrData
    1584 1540
       | IAmType
    
    1585 1541
       deriving (Eq, Data)
    
    1586 1542
     
    
    1587
    --- | When we only care whether a data-type declaration is `data` or `newtype`,
    
    1588
    --- but not what constructors it has.
    
    1589
    -data NewOrData
    
    1590
    -  = NewType                     -- ^ @newtype Blah ...@
    
    1591
    -  | DataType                    -- ^ @data Blah ...@
    
    1592
    -  deriving ( Eq, Data )                -- Needed because Demand derives Eq
    
    1593
    -
    
    1594 1543
     instance Outputable TypeOrData where
    
    1595 1544
       ppr (IAmData newOrData) = ppr newOrData
    
    1596 1545
       ppr IAmType = text "type"
    
    1597 1546
     
    
    1598
    -instance Outputable NewOrData where
    
    1599
    - ppr = \case
    
    1600
    -    NewType  -> text "newtype"
    
    1601
    -    DataType -> text "data"
    
    1602
    -
    
    1603 1547
     {- *********************************************************************
    
    1604 1548
     *                                                                      *
    
    1605 1549
                             Defaulting options
    

  • compiler/GHC/Utils/Binary.hs
    ... ... @@ -117,6 +117,7 @@ module GHC.Utils.Binary
    117 117
     
    
    118 118
     import GHC.Prelude
    
    119 119
     
    
    120
    +import Language.Haskell.Syntax.Basic
    
    120 121
     import Language.Haskell.Syntax.Binds.InlinePragma
    
    121 122
     import Language.Haskell.Syntax.Module.Name (ModuleName(..))
    
    122 123
     import Language.Haskell.Syntax.ImpExp.IsBoot (IsBootInterface(..))
    
    ... ... @@ -2011,6 +2012,12 @@ instance NFData a => NFData (FingerprintWithValue a) where
    2011 2012
       rnf (FingerprintWithValue fp mflags)
    
    2012 2013
         = rnf fp `seq` rnf mflags `seq` ()
    
    2013 2014
     
    
    2015
    +instance Binary Boxity where -- implemented via isBoxed-isomorphism to Bool
    
    2016
    +  put_ bh = put_ bh . isBoxed
    
    2017
    +  get bh  = do
    
    2018
    +    b <- get bh
    
    2019
    +    pure $ if b then Boxed else Unboxed
    
    2020
    +
    
    2014 2021
     instance Binary ConInfoTable where
    
    2015 2022
       get bh = Binary.decode <$> get bh
    
    2016 2023
     
    

  • compiler/GHC/Utils/Outputable.hs
    ... ... @@ -112,6 +112,7 @@ module GHC.Utils.Outputable (
    112 112
     import {-# SOURCE #-}   GHC.Unit.Types ( Unit, Module, moduleName )
    
    113 113
     import {-# SOURCE #-}   GHC.Types.Name.Occurrence( OccName )
    
    114 114
     
    
    115
    +import Language.Haskell.Syntax.Basic
    
    115 116
     import Language.Haskell.Syntax.Binds.InlinePragma
    
    116 117
     import Language.Haskell.Syntax.Module.Name ( ModuleName(..) )
    
    117 118
     
    
    ... ... @@ -2001,19 +2002,32 @@ instance IsDoc HDoc where
    2001 2002
       {-# INLINE CONLIKE dualDoc #-}
    
    2002 2003
     
    
    2003 2004
     instance Outputable (ActivationX p) where
    
    2004
    -   ppr AlwaysActive     = empty
    
    2005
    -   ppr NeverActive      = brackets (text "~")
    
    2006
    -   ppr (ActiveBefore n) = brackets (char '~' <> int n)
    
    2007
    -   ppr (ActiveAfter  n) = brackets (int n)
    
    2008
    -   ppr (XActivation  _) = text "[final]"
    
    2005
    +  ppr AlwaysActive     = empty
    
    2006
    +  ppr NeverActive      = brackets (text "~")
    
    2007
    +  ppr (ActiveBefore n) = brackets (char '~' <> int n)
    
    2008
    +  ppr (ActiveAfter  n) = brackets (int n)
    
    2009
    +  ppr (XActivation  _) = text "[final]"
    
    2009 2010
     
    
    2010 2011
     instance Outputable InlineSpec where
    
    2011
    -    ppr Inline           = text "INLINE"
    
    2012
    -    ppr NoInline         = text "NOINLINE"
    
    2013
    -    ppr Inlinable        = text "INLINABLE"
    
    2014
    -    ppr Opaque           = text "OPAQUE"
    
    2015
    -    ppr NoUserInlinePrag = empty
    
    2012
    +  ppr Inline           = text "INLINE"
    
    2013
    +  ppr NoInline         = text "NOINLINE"
    
    2014
    +  ppr Inlinable        = text "INLINABLE"
    
    2015
    +  ppr Opaque           = text "OPAQUE"
    
    2016
    +  ppr NoUserInlinePrag = empty
    
    2017
    +
    
    2018
    +instance Outputable Boxity where
    
    2019
    +  ppr Boxed   = text "Boxed"
    
    2020
    +  ppr Unboxed = text "Unboxed"
    
    2016 2021
     
    
    2017 2022
     instance Outputable RuleMatchInfo where
    
    2018
    -   ppr ConLike = text "CONLIKE"
    
    2019
    -   ppr FunLike = text "FUNLIKE"
    2023
    +  ppr ConLike = text "CONLIKE"
    
    2024
    +  ppr FunLike = text "FUNLIKE"
    
    2025
    +
    
    2026
    +instance Outputable NewOrData where
    
    2027
    +  ppr = \case
    
    2028
    +      NewType  -> text "newtype"
    
    2029
    +      DataType -> text "data"
    
    2030
    +
    
    2031
    +instance Outputable TopLevelFlag where
    
    2032
    +  ppr TopLevel    = text "<TopLevel>"
    
    2033
    +  ppr NotTopLevel = text "<NotTopLevel>"

  • compiler/Language/Haskell/Syntax/Basic.hs
    ... ... @@ -10,6 +10,37 @@ import Prelude
    10 10
     import GHC.Data.FastString (FastString)
    
    11 11
     import Control.DeepSeq
    
    12 12
     
    
    13
    +{-
    
    14
    +************************************************************************
    
    15
    +*                                                                      *
    
    16
    +Rules
    
    17
    +*                                                                      *
    
    18
    +************************************************************************
    
    19
    +-}
    
    20
    +
    
    21
    +type RuleName = FastString
    
    22
    +
    
    23
    +{-
    
    24
    +************************************************************************
    
    25
    +*                                                                      *
    
    26
    +\subsection[Top-level/local]{Top-level/not-top level flag}
    
    27
    +*                                                                      *
    
    28
    +************************************************************************
    
    29
    +-}
    
    30
    +
    
    31
    +data TopLevelFlag
    
    32
    +  = TopLevel
    
    33
    +  | NotTopLevel
    
    34
    +  deriving Data
    
    35
    +
    
    36
    +isTopLevel, isNotTopLevel :: TopLevelFlag -> Bool
    
    37
    +
    
    38
    +isNotTopLevel NotTopLevel = True
    
    39
    +isNotTopLevel TopLevel    = False
    
    40
    +
    
    41
    +isTopLevel TopLevel     = True
    
    42
    +isTopLevel NotTopLevel  = False
    
    43
    +
    
    13 44
     {-
    
    14 45
     ************************************************************************
    
    15 46
     *                                                                      *
    
    ... ... @@ -125,3 +156,10 @@ data Fixity = Fixity Int FixityDirection
    125 156
     
    
    126 157
     instance NFData Fixity where
    
    127 158
       rnf (Fixity i d) = rnf i `seq` rnf d `seq` ()
    
    159
    +
    
    160
    +-- | When we only care whether a data-type declaration is `data` or `newtype`,
    
    161
    +-- but not what constructors it has.
    
    162
    +data NewOrData
    
    163
    +  = NewType                     -- ^ @newtype Blah ...@
    
    164
    +  | DataType                    -- ^ @data Blah ...@
    
    165
    +  deriving ( Eq, Data )         -- Needed because Demand derives Eq

  • compiler/Language/Haskell/Syntax/Decls.hs
    ... ... @@ -18,7 +18,7 @@ module Language.Haskell.Syntax.Decls (
    18 18
       -- * Toplevel declarations
    
    19 19
       HsDecl(..), LHsDecl, HsDataDefn(..), HsDeriving, LHsFunDep, FunDep(..),
    
    20 20
       HsDerivingClause(..), LHsDerivingClause, DerivClauseTys(..), LDerivClauseTys,
    
    21
    -  NewOrData(..), DataDefnCons(..), dataDefnConsNewOrData,
    
    21
    +  NewOrData(..), DataDefnCons(..),
    
    22 22
       isTypeDataDefnCons, firstDataDefnCon,
    
    23 23
       StandaloneKindSig(..), LStandaloneKindSig,
    
    24 24
     
    
    ... ... @@ -31,7 +31,7 @@ module Language.Haskell.Syntax.Decls (
    31 31
       FamilyDecl(..), LFamilyDecl,
    
    32 32
     
    
    33 33
       -- ** Instance declarations
    
    34
    -  InstDecl(..), LInstDecl, FamilyInfo(..), familyInfoTyConFlavour,
    
    34
    +  InstDecl(..), LInstDecl, FamilyInfo(..),
    
    35 35
       TyFamInstDecl(..), LTyFamInstDecl,
    
    36 36
       TyFamDefltDecl, LTyFamDefltDecl,
    
    37 37
       DataFamInstDecl(..), LDataFamInstDecl,
    
    ... ... @@ -91,6 +91,7 @@ import {-# SOURCE #-} Language.Haskell.Syntax.Expr
    91 91
       ( HsExpr, HsUntypedSplice )
    
    92 92
             -- Because Expr imports Decls via HsBracket
    
    93 93
     
    
    94
    +import Language.Haskell.Syntax.Basic (TopLevelFlag, RuleName, NewOrData(..))
    
    94 95
     import Language.Haskell.Syntax.Binds
    
    95 96
     import Language.Haskell.Syntax.Binds.InlinePragma (Activation)
    
    96 97
     import Language.Haskell.Syntax.Extension
    
    ... ... @@ -98,8 +99,7 @@ import Language.Haskell.Syntax.Type
    98 99
     import Language.Haskell.Syntax.Basic (Role, LexicalFixity)
    
    99 100
     import Language.Haskell.Syntax.Specificity (Specificity)
    
    100 101
     
    
    101
    -import GHC.Types.Basic (TopLevelFlag, OverlapMode, RuleName
    
    102
    -                       ,TyConFlavour(..), TypeOrData(..), NewOrData(..))
    
    102
    +import GHC.Types.Basic (OverlapMode)
    
    103 103
     import GHC.Types.ForeignCall (CType, CCallConv, Safety, Header, CLabelString, CCallTarget, CExportSpec)
    
    104 104
     
    
    105 105
     import GHC.Data.FastString (FastString)
    
    ... ... @@ -108,7 +108,6 @@ import GHC.Hs.Doc (WithHsDocIdentifiers)
    108 108
     import GHC.Types.SourceText (StringLiteral)
    
    109 109
     
    
    110 110
     import Control.DeepSeq
    
    111
    -import Control.Exception (assert)
    
    112 111
     import Control.Monad
    
    113 112
     import Data.Data        hiding (TyCon, Fixity, Infix)
    
    114 113
     import Data.Maybe
    
    ... ... @@ -779,18 +778,6 @@ data FamilyInfo pass
    779 778
          -- said "type family Foo x where .."
    
    780 779
       | ClosedTypeFamily (Maybe [LTyFamInstEqn pass])
    
    781 780
     
    
    782
    -familyInfoTyConFlavour
    
    783
    -  :: Maybe tc    -- ^ Just cls <=> this is an associated family of class cls
    
    784
    -  -> FamilyInfo pass
    
    785
    -  -> TyConFlavour tc
    
    786
    -familyInfoTyConFlavour mb_parent_tycon info =
    
    787
    -  case info of
    
    788
    -    DataFamily         -> OpenFamilyFlavour (IAmData DataType) mb_parent_tycon
    
    789
    -    OpenTypeFamily     -> OpenFamilyFlavour IAmType mb_parent_tycon
    
    790
    -    ClosedTypeFamily _ -> assert (isNothing mb_parent_tycon)
    
    791
    -                          -- See Note [Closed type family mb_parent_tycon]
    
    792
    -                          ClosedTypeFamilyFlavour
    
    793
    -
    
    794 781
     {- Note [Closed type family mb_parent_tycon]
    
    795 782
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    796 783
     There's no way to write a closed type family inside a class declaration:
    
    ... ... @@ -932,11 +919,6 @@ data DataDefnCons a
    932 919
           [a]    -- The (possibly empty) list of data constructors
    
    933 920
       deriving ( Eq, Data, Foldable, Functor, Traversable )                -- Needed because Demand derives Eq
    
    934 921
     
    
    935
    -dataDefnConsNewOrData :: DataDefnCons a -> NewOrData
    
    936
    -dataDefnConsNewOrData = \ case
    
    937
    -    NewTypeCon   {} -> NewType
    
    938
    -    DataTypeCons {} -> DataType
    
    939
    -
    
    940 922
     -- | Are the constructors within a @type data@ declaration?
    
    941 923
     -- See Note [Type data declarations] in GHC.Rename.Module.
    
    942 924
     isTypeDataDefnCons :: DataDefnCons a -> Bool
    

  • utils/haddock/haddock-api/src/Haddock/Backends/Hoogle.hs
    ... ... @@ -33,7 +33,6 @@ import GHC
    33 33
     import GHC.Core.InstEnv
    
    34 34
     import qualified GHC.Driver.DynFlags as DynFlags
    
    35 35
     import GHC.Driver.Ppr
    
    36
    -import GHC.Plugins (TopLevelFlag (..))
    
    37 36
     import GHC.Types.SourceText
    
    38 37
     import GHC.Unit.State
    
    39 38
     import GHC.Utils.Outputable as Outputable
    

  • utils/haddock/haddock-api/src/Haddock/Convert.hs
    ... ... @@ -59,7 +59,7 @@ import GHC.Core.TyCo.Rep
    59 59
     import GHC.Core.TyCon
    
    60 60
     import GHC.Core.Type
    
    61 61
     import GHC.Hs
    
    62
    -import GHC.Types.Basic (DefMethSpec (..), TopLevelFlag (..), TupleSort (..))
    
    62
    +import GHC.Types.Basic (DefMethSpec (..), TupleSort (..))
    
    63 63
     import GHC.Types.Id (idType, setIdType)
    
    64 64
     import GHC.Types.Name
    
    65 65
     import GHC.Types.Name.Reader (mkVarUnqual)
    

  • utils/haddock/haddock-api/src/Haddock/Interface/Rename.hs
    ... ... @@ -37,7 +37,7 @@ import GHC hiding (NoLink, HsTypeGhcPsExt (..))
    37 37
     import GHC.Builtin.Types (eqTyCon_RDR, tupleDataConName, tupleTyConName)
    
    38 38
     import GHC.Core.TyCon (tyConResKind)
    
    39 39
     import GHC.Driver.DynFlags (getDynFlags)
    
    40
    -import GHC.Types.Basic (TopLevelFlag (..), TupleSort (..))
    
    40
    +import GHC.Types.Basic (TupleSort (..))
    
    41 41
     import GHC.Types.Name
    
    42 42
     import GHC.Types.Name.Reader (RdrName (Exact))
    
    43 43
     import Language.Haskell.Syntax.BooleanFormula(BooleanFormula(..))