    {-# LANGUAGE LambdaCase #-}

    module GHC.Driver.Flags
       ( DumpFlag(..)
       , getDumpFlagFrom
       , enabledIfVerbose
       , GeneralFlag(..)
       , Language(..)
       , defaultLanguage
       , optimisationFlags
       , codeGenFlags

       -- * Warnings
       , WarningGroup(..)
       , warningGroupName
       , warningGroupFlags
       , warningGroupIncludesExtendedWarnings
       , WarningFlag(..)
       , warnFlagNames
       , warningGroups
       , warningHierarchies
       , smallestWarningGroups
       , smallestWarningGroupsForCategory

       , standardWarnings
       , minusWOpts
       , minusWallOpts
       , minusWeverythingOpts
       , minusWcompatOpts
       , unusedBindsFlags

       , TurnOnFlag
       , turnOn
       , turnOff
       , impliedXFlags
       , validHoleFitsImpliedGFlags
       , impliedGFlags
       , impliedOffGFlags
       , glasgowExtsFlags

       , ExtensionDeprecation(..)
       , Deprecation(..)
       , extensionDeprecation
       , deprecation
       , extensionNames
       , extensionName
       )
    where

    import GHC.Prelude
    import GHC.Utils.Outputable
    import GHC.Utils.Binary
    import GHC.Data.EnumSet as EnumSet

    import Control.DeepSeq
    import Control.Monad (guard)
    import Data.List.NonEmpty (NonEmpty(..))
    import Data.Maybe (fromMaybe,mapMaybe)

    import qualified GHC.LanguageExtensions as LangExt

    data Language = Haskell98 | Haskell2010 | GHC2021 | GHC2024
       deriving (Language -> Language -> Bool
    (Language -> Language -> Bool)
    -> (Language -> Language -> Bool) -> Eq Language
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Language -> Language -> Bool
    == :: Language -> Language -> Bool
    $c/= :: Language -> Language -> Bool
    /= :: Language -> Language -> Bool
    Eq, Int -> Language
    Language -> Int
    Language -> [Language]
    Language -> Language
    Language -> Language -> [Language]
    Language -> Language -> Language -> [Language]
    (Language -> Language)
    -> (Language -> Language)
    -> (Int -> Language)
    -> (Language -> Int)
    -> (Language -> [Language])
    -> (Language -> Language -> [Language])
    -> (Language -> Language -> [Language])
    -> (Language -> Language -> Language -> [Language])
    -> Enum Language
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: Language -> Language
    succ :: Language -> Language
    $cpred :: Language -> Language
    pred :: Language -> Language
    $ctoEnum :: Int -> Language
    toEnum :: Int -> Language
    $cfromEnum :: Language -> Int
    fromEnum :: Language -> Int
    $cenumFrom :: Language -> [Language]
    enumFrom :: Language -> [Language]
    $cenumFromThen :: Language -> Language -> [Language]
    enumFromThen :: Language -> Language -> [Language]
    $cenumFromTo :: Language -> Language -> [Language]
    enumFromTo :: Language -> Language -> [Language]
    $cenumFromThenTo :: Language -> Language -> Language -> [Language]
    enumFromThenTo :: Language -> Language -> Language -> [Language]
    Enum, Int -> Language -> ShowS
    [Language] -> ShowS
    Language -> String
    (Int -> Language -> ShowS)
    -> (Language -> String) -> ([Language] -> ShowS) -> Show Language
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> Language -> ShowS
    showsPrec :: Int -> Language -> ShowS
    $cshow :: Language -> String
    show :: Language -> String
    $cshowList :: [Language] -> ShowS
    showList :: [Language] -> ShowS
    Show, Language
    Language -> Language -> Bounded Language
    forall a. a -> a -> Bounded a
    $cminBound :: Language
    minBound :: Language
    $cmaxBound :: Language
    maxBound :: Language
    Bounded)

    -- | The default Language is used if one is not specified explicitly, by both
    -- GHC and GHCi.
    defaultLanguage :: Language
    defaultLanguage :: Language
    defaultLanguage = Language
    GHC2021

    instance Outputable Language where
        ppr :: Language -> SDoc
    ppr = String -> SDoc
    forall doc. IsLine doc => String -> doc
    text (String -> SDoc) -> (Language -> String) -> Language -> SDoc
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Language -> String
    forall a. Show a => a -> String
    show

    instance Binary Language where
      put_ :: WriteBinHandle -> Language -> IO ()
    put_ WriteBinHandle
    bh = WriteBinHandle -> Int -> IO ()
    forall a. Binary a => WriteBinHandle -> a -> IO ()
    put_ WriteBinHandle
    bh (Int -> IO ()) -> (Language -> Int) -> Language -> IO ()
    forall b c a. (b -> c) -> (a -> b) -> a -> c
    . Language -> Int
    forall a. Enum a => a -> Int
    fromEnum
      get :: ReadBinHandle -> IO Language
    get ReadBinHandle
    bh = Int -> Language
    forall a. Enum a => Int -> a
    toEnum (Int -> Language) -> IO Int -> IO Language
    forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
    <$> ReadBinHandle -> IO Int
    forall a. Binary a => ReadBinHandle -> IO a
    get ReadBinHandle
    bh

    instance NFData Language where
      rnf :: Language -> ()
    rnf Language
    x = Language
    x Language -> () -> ()
    forall a b. a -> b -> b
    `seq` ()

    type TurnOnFlag = Bool   -- True  <=> we are turning the flag on
                             -- False <=> we are turning the flag off
    turnOn  :: TurnOnFlag; turnOn :: Bool
    turnOn  = Bool
    True
    turnOff :: TurnOnFlag; turnOff :: Bool
    turnOff = Bool
    False

    data Deprecation = NotDeprecated | Deprecated deriving (Deprecation -> Deprecation -> Bool
    (Deprecation -> Deprecation -> Bool)
    -> (Deprecation -> Deprecation -> Bool) -> Eq Deprecation
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: Deprecation -> Deprecation -> Bool
    == :: Deprecation -> Deprecation -> Bool
    $c/= :: Deprecation -> Deprecation -> Bool
    /= :: Deprecation -> Deprecation -> Bool
    Eq, Eq Deprecation
    Eq Deprecation =>
    (Deprecation -> Deprecation -> Ordering)
    -> (Deprecation -> Deprecation -> Bool)
    -> (Deprecation -> Deprecation -> Bool)
    -> (Deprecation -> Deprecation -> Bool)
    -> (Deprecation -> Deprecation -> Bool)
    -> (Deprecation -> Deprecation -> Deprecation)
    -> (Deprecation -> Deprecation -> Deprecation)
    -> Ord Deprecation
    Deprecation -> Deprecation -> Bool
    Deprecation -> Deprecation -> Ordering
    Deprecation -> Deprecation -> Deprecation
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: Deprecation -> Deprecation -> Ordering
    compare :: Deprecation -> Deprecation -> Ordering
    $c< :: Deprecation -> Deprecation -> Bool
    < :: Deprecation -> Deprecation -> Bool
    $c<= :: Deprecation -> Deprecation -> Bool
    <= :: Deprecation -> Deprecation -> Bool
    $c> :: Deprecation -> Deprecation -> Bool
    > :: Deprecation -> Deprecation -> Bool
    $c>= :: Deprecation -> Deprecation -> Bool
    >= :: Deprecation -> Deprecation -> Bool
    $cmax :: Deprecation -> Deprecation -> Deprecation
    max :: Deprecation -> Deprecation -> Deprecation
    $cmin :: Deprecation -> Deprecation -> Deprecation
    min :: Deprecation -> Deprecation -> Deprecation
    Ord)

    data ExtensionDeprecation
      = ExtensionNotDeprecated
      | ExtensionDeprecatedFor [LangExt.Extension]
      | ExtensionFlagDeprecatedCond TurnOnFlag String
      | ExtensionFlagDeprecated String
      deriving ExtensionDeprecation -> ExtensionDeprecation -> Bool
    (ExtensionDeprecation -> ExtensionDeprecation -> Bool)
    -> (ExtensionDeprecation -> ExtensionDeprecation -> Bool)
    -> Eq ExtensionDeprecation
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: ExtensionDeprecation -> ExtensionDeprecation -> Bool
    == :: ExtensionDeprecation -> ExtensionDeprecation -> Bool
    $c/= :: ExtensionDeprecation -> ExtensionDeprecation -> Bool
    /= :: ExtensionDeprecation -> ExtensionDeprecation -> Bool
    Eq

    -- | Always returns 'Deprecated' even when the flag is
    -- only conditionally deprecated.
    deprecation :: ExtensionDeprecation -> Deprecation
    deprecation :: ExtensionDeprecation -> Deprecation
    deprecation ExtensionDeprecation
    ExtensionNotDeprecated = Deprecation
    NotDeprecated
    deprecation ExtensionDeprecation
    _ = Deprecation
    Deprecated

    extensionDeprecation :: LangExt.Extension -> ExtensionDeprecation
    extensionDeprecation :: Extension -> ExtensionDeprecation
    extensionDeprecation = \case
      Extension
    LangExt.TypeInType           -> [Extension] -> ExtensionDeprecation
    ExtensionDeprecatedFor [Extension
    LangExt.DataKinds, Extension
    LangExt.PolyKinds]
      Extension
    LangExt.NullaryTypeClasses   -> [Extension] -> ExtensionDeprecation
    ExtensionDeprecatedFor [Extension
    LangExt.MultiParamTypeClasses]
      Extension
    LangExt.RelaxedPolyRec       -> Bool -> String -> ExtensionDeprecation
    ExtensionFlagDeprecatedCond Bool
    turnOff
                                        String
    "You can't turn off RelaxedPolyRec any more"
      Extension
    LangExt.DatatypeContexts     -> Bool -> String -> ExtensionDeprecation
    ExtensionFlagDeprecatedCond Bool
    turnOn
                                        String
    "It was widely considered a misfeature, and has been removed from the Haskell language."
      Extension
    LangExt.AutoDeriveTypeable   -> Bool -> String -> ExtensionDeprecation
    ExtensionFlagDeprecatedCond Bool
    turnOn
                                        String
    "Typeable instances are created automatically for all types since GHC 8.2."
      Extension
    LangExt.OverlappingInstances -> String -> ExtensionDeprecation
    ExtensionFlagDeprecated
                                        String
    "instead use per-instance pragmas OVERLAPPING/OVERLAPPABLE/OVERLAPS"
      Extension
    _                            -> ExtensionDeprecation
    ExtensionNotDeprecated

    extensionName :: LangExt.Extension -> String
    extensionName :: Extension -> String
    extensionName = \case
      Extension
    LangExt.Cpp -> String
    "CPP"
      Extension
    LangExt.OverlappingInstances -> String
    "OverlappingInstances"
      Extension
    LangExt.UndecidableInstances -> String
    "UndecidableInstances"
      Extension
    LangExt.IncoherentInstances -> String
    "IncoherentInstances"
      Extension
    LangExt.UndecidableSuperClasses -> String
    "UndecidableSuperClasses"
      Extension
    LangExt.MonomorphismRestriction -> String
    "MonomorphismRestriction"
      Extension
    LangExt.MonoLocalBinds -> String
    "MonoLocalBinds"
      Extension
    LangExt.DeepSubsumption -> String
    "DeepSubsumption"
      Extension
    LangExt.RelaxedPolyRec -> String
    "RelaxedPolyRec"           -- Deprecated
      Extension
    LangExt.ExtendedDefaultRules -> String
    "ExtendedDefaultRules"     -- Use GHC's extended rules for defaulting
      Extension
    LangExt.NamedDefaults -> String
    "NamedDefaults"
      Extension
    LangExt.ForeignFunctionInterface -> String
    "ForeignFunctionInterface"
      Extension
    LangExt.UnliftedFFITypes -> String
    "UnliftedFFITypes"
      Extension
    LangExt.InterruptibleFFI -> String
    "InterruptibleFFI"
      Extension
    LangExt.CApiFFI -> String
    "CApiFFI"
      Extension
    LangExt.GHCForeignImportPrim -> String
    "GHCForeignImportPrim"
      Extension
    LangExt.JavaScriptFFI -> String
    "JavaScriptFFI"
      Extension
    LangExt.ParallelArrays -> String
    "ParallelArrays"           -- Syntactic support for parallel arrays
      Extension
    LangExt.Arrows -> String
    "Arrows"                   -- Arrow-notation syntax
      Extension
    LangExt.TemplateHaskell -> String
    "TemplateHaskell"
      Extension
    LangExt.TemplateHaskellQuotes -> String
    "TemplateHaskellQuotes"    -- subset of TH supported by stage1, no splice
      Extension
    LangExt.QualifiedDo -> String
    "QualifiedDo"
      Extension
    LangExt.QuasiQuotes -> String
    "QuasiQuotes"
      Extension
    LangExt.ImplicitParams -> String
    "ImplicitParams"
      Extension
    LangExt.ImplicitPrelude -> String
    "ImplicitPrelude"
      Extension
    LangExt.ScopedTypeVariables -> String
    "ScopedTypeVariables"
      Extension
    LangExt.AllowAmbiguousTypes -> String
    "AllowAmbiguousTypes"
      Extension
    LangExt.UnboxedTuples -> String
    "UnboxedTuples"
      Extension
    LangExt.UnboxedSums -> String
    "UnboxedSums"
      Extension
    LangExt.UnliftedNewtypes -> String
    "UnliftedNewtypes"
      Extension
    LangExt.UnliftedDatatypes -> String
    "UnliftedDatatypes"
      Extension
    LangExt.BangPatterns -> String
    "BangPatterns"
      Extension
    LangExt.TypeFamilies -> String
    "TypeFamilies"
      Extension
    LangExt.TypeFamilyDependencies -> String
    "TypeFamilyDependencies"
      Extension
    LangExt.TypeInType -> String
    "TypeInType"               -- Deprecated
      Extension
    LangExt.OverloadedStrings -> String
    "OverloadedStrings"
      Extension
    LangExt.OverloadedLists -> String
    "OverloadedLists"
      Extension
    LangExt.NumDecimals -> String
    "NumDecimals"
      Extension
    LangExt.OrPatterns -> String
    "OrPatterns"
      Extension
    LangExt.DisambiguateRecordFields -> String
    "DisambiguateRecordFields"
      Extension
    LangExt.RecordWildCards -> String
    "RecordWildCards"
      Extension
    LangExt.NamedFieldPuns -> String
    "NamedFieldPuns"
      Extension
    LangExt.ViewPatterns -> String
    "ViewPatterns"
      Extension
    LangExt.GADTs -> String
    "GADTs"
      Extension
    LangExt.GADTSyntax -> String
    "GADTSyntax"
      Extension
    LangExt.NPlusKPatterns -> String
    "NPlusKPatterns"
      Extension
    LangExt.DoAndIfThenElse -> String
    "DoAndIfThenElse"
      Extension
    LangExt.BlockArguments -> String
    "BlockArguments"
      Extension
    LangExt.RebindableSyntax -> String
    "RebindableSyntax"
      Extension
    LangExt.ConstraintKinds -> String
    "ConstraintKinds"
      Extension
    LangExt.PolyKinds -> String
    "PolyKinds"                -- Kind polymorphism
      Extension
    LangExt.DataKinds -> String
    "DataKinds"                -- Datatype promotion
      Extension
    LangExt.TypeData -> String
    "TypeData"                 -- allow @type data@ definitions
      Extension
    LangExt.InstanceSigs -> String
    "InstanceSigs"
      Extension
    LangExt.ApplicativeDo -> String
    "ApplicativeDo"
      Extension
    LangExt.LinearTypes -> String
    "LinearTypes"
      Extension
    LangExt.RequiredTypeArguments -> String
    "RequiredTypeArguments"    -- Visible forall (VDQ) in types of terms
      Extension
    LangExt.StandaloneDeriving -> String
    "StandaloneDeriving"
      Extension
    LangExt.DeriveDataTypeable -> String
    "DeriveDataTypeable"
      Extension
    LangExt.AutoDeriveTypeable -> String
    "AutoDeriveTypeable"       -- Automatic derivation of Typeable
      Extension
    LangExt.DeriveFunctor -> String
    "DeriveFunctor"
      Extension
    LangExt.DeriveTraversable -> String
    "DeriveTraversable"
      Extension
    LangExt.DeriveFoldable -> String
    "DeriveFoldable"
      Extension
    LangExt.DeriveGeneric -> String
    "DeriveGeneric"            -- Allow deriving Generic/1
      Extension
    LangExt.DefaultSignatures -> String
    "DefaultSignatures"        -- Allow extra signatures for defmeths
      Extension
    LangExt.DeriveAnyClass -> String
    "DeriveAnyClass"           -- Allow deriving any class
      Extension
    LangExt.DeriveLift -> String
    "DeriveLift"               -- Allow deriving Lift
      Extension
    LangExt.DerivingStrategies -> String
    "DerivingStrategies"
      Extension
    LangExt.DerivingVia -> String
    "DerivingVia"              -- Derive through equal representation
      Extension
    LangExt.TypeSynonymInstances -> String
    "TypeSynonymInstances"
      Extension
    LangExt.FlexibleContexts -> String
    "FlexibleContexts"
      Extension
    LangExt.FlexibleInstances -> String
    "FlexibleInstances"
      Extension
    LangExt.ConstrainedClassMethods -> String
    "ConstrainedClassMethods"
      Extension
    LangExt.MultiParamTypeClasses -> String
    "MultiParamTypeClasses"
      Extension
    LangExt.NullaryTypeClasses -> String
    "NullaryTypeClasses"
      Extension
    LangExt.FunctionalDependencies -> String
    "FunctionalDependencies"
      Extension
    LangExt.UnicodeSyntax -> String
    "UnicodeSyntax"
      Extension
    LangExt.ExistentialQuantification -> String
    "ExistentialQuantification"
      Extension
    LangExt.MagicHash -> String
    "MagicHash"
      Extension
    LangExt.EmptyDataDecls -> String
    "EmptyDataDecls"
      Extension
    LangExt.KindSignatures -> String
    "KindSignatures"
      Extension
    LangExt.RoleAnnotations -> String
    "RoleAnnotations"
      Extension
    LangExt.ParallelListComp -> String
    "ParallelListComp"
      Extension
    LangExt.TransformListComp -> String
    "TransformListComp"
      Extension
    LangExt.MonadComprehensions -> String
    "MonadComprehensions"
      Extension
    LangExt.GeneralizedNewtypeDeriving -> String
    "GeneralizedNewtypeDeriving"
      Extension
    LangExt.RecursiveDo -> String
    "RecursiveDo"
      Extension
    LangExt.PostfixOperators -> String
    "PostfixOperators"
      Extension
    LangExt.TupleSections -> String
    "TupleSections"
      Extension
    LangExt.PatternGuards -> String
    "PatternGuards"
      Extension
    LangExt.LiberalTypeSynonyms -> String
    "LiberalTypeSynonyms"
      Extension
    LangExt.RankNTypes -> String
    "RankNTypes"
      Extension
    LangExt.ImpredicativeTypes -> String
    "ImpredicativeTypes"
      Extension
    LangExt.TypeOperators -> String
    "TypeOperators"
      Extension
    LangExt.ExplicitNamespaces -> String
    "ExplicitNamespaces"
      Extension
    LangExt.PackageImports -> String
    "PackageImports"
      Extension
    LangExt.ExplicitForAll -> String
    "ExplicitForAll"
      Extension
    LangExt.AlternativeLayoutRule -> String
    "AlternativeLayoutRule"
      Extension
    LangExt.AlternativeLayoutRuleTransitional -> String
    "AlternativeLayoutRuleTransitional"
      Extension
    LangExt.DatatypeContexts -> String
    "DatatypeContexts"
      Extension
    LangExt.NondecreasingIndentation -> String
    "NondecreasingIndentation"
      Extension
    LangExt.RelaxedLayout -> String
    "RelaxedLayout"
      Extension
    LangExt.TraditionalRecordSyntax -> String
    "TraditionalRecordSyntax"
      Extension
    LangExt.LambdaCase -> String
    "LambdaCase"
      Extension
    LangExt.MultiWayIf -> String
    "MultiWayIf"
      Extension
    LangExt.BinaryLiterals -> String
    "BinaryLiterals"
      Extension
    LangExt.NegativeLiterals -> String
    "NegativeLiterals"
      Extension
    LangExt.HexFloatLiterals -> String
    "HexFloatLiterals"
      Extension
    LangExt.DuplicateRecordFields -> String
    "DuplicateRecordFields"
      Extension
    LangExt.OverloadedLabels -> String
    "OverloadedLabels"
      Extension
    LangExt.EmptyCase -> String
    "EmptyCase"
      Extension
    LangExt.PatternSynonyms -> String
    "PatternSynonyms"
      Extension
    LangExt.PartialTypeSignatures -> String
    "PartialTypeSignatures"
      Extension
    LangExt.NamedWildCards -> String
    "NamedWildCards"
      Extension
    LangExt.StaticPointers -> String
    "StaticPointers"
      Extension
    LangExt.TypeApplications -> String
    "TypeApplications"
      Extension
    LangExt.Strict -> String
    "Strict"
      Extension
    LangExt.StrictData -> String
    "StrictData"
      Extension
    LangExt.EmptyDataDeriving -> String
    "EmptyDataDeriving"
      Extension
    LangExt.NumericUnderscores -> String
    "NumericUnderscores"
      Extension
    LangExt.QuantifiedConstraints -> String
    "QuantifiedConstraints"
      Extension
    LangExt.StarIsType -> String
    "StarIsType"
      Extension
    LangExt.ImportQualifiedPost -> String
    "ImportQualifiedPost"
      Extension
    LangExt.CUSKs -> String
    "CUSKs"
      Extension
    LangExt.StandaloneKindSignatures -> String
    "StandaloneKindSignatures"
      Extension
    LangExt.LexicalNegation -> String
    "LexicalNegation"
      Extension
    LangExt.FieldSelectors -> String
    "FieldSelectors"
      Extension
    LangExt.OverloadedRecordDot -> String
    "OverloadedRecordDot"
      Extension
    LangExt.OverloadedRecordUpdate -> String
    "OverloadedRecordUpdate"
      Extension
    LangExt.TypeAbstractions -> String
    "TypeAbstractions"
      Extension
    LangExt.ExtendedLiterals -> String
    "ExtendedLiterals"
      Extension
    LangExt.ListTuplePuns -> String
    "ListTuplePuns"
      Extension
    LangExt.MultilineStrings -> String
    "MultilineStrings"

    -- | Is this extension known by any other names? For example
    -- -XGeneralizedNewtypeDeriving is accepted
    extensionAlternateNames :: LangExt.Extension -> [String]
    extensionAlternateNames :: Extension -> [String]
    extensionAlternateNames = \case
      Extension
    LangExt.GeneralizedNewtypeDeriving -> [String
    "GeneralisedNewtypeDeriving"]
      Extension
    LangExt.RankNTypes                 -> [String
    "Rank2Types", String
    "PolymorphicComponents"]
      Extension
    _ -> []

    extensionDeprecatedNames :: LangExt.Extension -> [String]
    extensionDeprecatedNames :: Extension -> [String]
    extensionDeprecatedNames = \case
      Extension
    LangExt.RecursiveDo         -> [String
    "DoRec"]
      Extension
    LangExt.NamedFieldPuns      -> [String
    "RecordPuns"]
      Extension
    LangExt.ScopedTypeVariables -> [String
    "PatternSignatures"]
      Extension
    _ -> []

    -- | All the names by which an extension is known.
    extensionNames :: LangExt.Extension -> [ (ExtensionDeprecation, String) ]
    extensionNames :: Extension -> [(ExtensionDeprecation, String)]
    extensionNames Extension
    ext = ExtensionDeprecation
    -> [String] -> [(ExtensionDeprecation, String)]
    forall {a} {b}. a -> [b] -> [(a, b)]
    mk (Extension -> ExtensionDeprecation
    extensionDeprecation Extension
    ext)     (Extension -> String
    extensionName Extension
    ext String -> [String] -> [String]
    forall a. a -> [a] -> [a]
    : Extension -> [String]
    extensionAlternateNames Extension
    ext)
                      [(ExtensionDeprecation, String)]
    -> [(ExtensionDeprecation, String)]
    -> [(ExtensionDeprecation, String)]
    forall a. [a] -> [a] -> [a]
    ++ ExtensionDeprecation
    -> [String] -> [(ExtensionDeprecation, String)]
    forall {a} {b}. a -> [b] -> [(a, b)]
    mk ([Extension] -> ExtensionDeprecation
    ExtensionDeprecatedFor [Extension
    ext]) (Extension -> [String]
    extensionDeprecatedNames Extension
    ext)
      where mk :: a -> [b] -> [(a, b)]
    mk a
    depr = (b -> (a, b)) -> [b] -> [(a, b)]
    forall a b. (a -> b) -> [a] -> [b]
    map (\b
    name -> (a
    depr, b
    name))

    impliedXFlags :: [(LangExt.Extension, TurnOnFlag, LangExt.Extension)]
    impliedXFlags :: [(Extension, Bool, Extension)]
    impliedXFlags
    -- See Note [Updating flag description in the User's Guide]
      = [ (Extension
    LangExt.RankNTypes,                Bool
    turnOn, Extension
    LangExt.ExplicitForAll)
        , (Extension
    LangExt.QuantifiedConstraints,     Bool
    turnOn, Extension
    LangExt.ExplicitForAll)
        , (Extension
    LangExt.ScopedTypeVariables,       Bool
    turnOn, Extension
    LangExt.ExplicitForAll)
        , (Extension
    LangExt.LiberalTypeSynonyms,       Bool
    turnOn, Extension
    LangExt.ExplicitForAll)
        , (Extension
    LangExt.ExistentialQuantification, Bool
    turnOn, Extension
    LangExt.ExplicitForAll)
        , (Extension
    LangExt.FlexibleInstances,         Bool
    turnOn, Extension
    LangExt.TypeSynonymInstances)
        , (Extension
    LangExt.FunctionalDependencies,    Bool
    turnOn, Extension
    LangExt.MultiParamTypeClasses)
        , (Extension
    LangExt.MultiParamTypeClasses,     Bool
    turnOn, Extension
    LangExt.ConstrainedClassMethods)  -- c.f. #7854
        , (Extension
    LangExt.TypeFamilyDependencies,    Bool
    turnOn, Extension
    LangExt.TypeFamilies)

        , (Extension
    LangExt.RebindableSyntax, Bool
    turnOff, Extension
    LangExt.ImplicitPrelude)      -- NB: turn off!

        , (Extension
    LangExt.DerivingVia, Bool
    turnOn, Extension
    LangExt.DerivingStrategies)

        , (Extension
    LangExt.GADTs,            Bool
    turnOn, Extension
    LangExt.GADTSyntax)
        , (Extension
    LangExt.GADTs,            Bool
    turnOn, Extension
    LangExt.MonoLocalBinds)
        , (Extension
    LangExt.TypeFamilies,     Bool
    turnOn, Extension
    LangExt.MonoLocalBinds)

        , (Extension
    LangExt.TypeFamilies,     Bool
    turnOn, Extension
    LangExt.KindSignatures)  -- Type families use kind signatures
        , (Extension
    LangExt.PolyKinds,        Bool
    turnOn, Extension
    LangExt.KindSignatures)  -- Ditto polymorphic kinds

        -- TypeInType is now just a synonym for a couple of other extensions.
        , (Extension
    LangExt.TypeInType,       Bool
    turnOn, Extension
    LangExt.DataKinds)
        , (Extension
    LangExt.TypeInType,       Bool
    turnOn, Extension
    LangExt.PolyKinds)
        , (Extension
    LangExt.TypeInType,       Bool
    turnOn, Extension
    LangExt.KindSignatures)

        -- Standalone kind signatures are a replacement for CUSKs.
        , (Extension
    LangExt.StandaloneKindSignatures, Bool
    turnOff, Extension
    LangExt.CUSKs)

        -- AutoDeriveTypeable is not very useful without DeriveDataTypeable
        , (Extension
    LangExt.AutoDeriveTypeable, Bool
    turnOn, Extension
    LangExt.DeriveDataTypeable)

        -- We turn this on so that we can export associated type
        -- type synonyms in subordinates (e.g. MyClass(type AssocType))
        , (Extension
    LangExt.TypeFamilies,     Bool
    turnOn, Extension
    LangExt.ExplicitNamespaces)
        , (Extension
    LangExt.TypeOperators, Bool
    turnOn, Extension
    LangExt.ExplicitNamespaces)

        , (Extension
    LangExt.ImpredicativeTypes,  Bool
    turnOn, Extension
    LangExt.RankNTypes)

            -- Record wild-cards implies field disambiguation
            -- Otherwise if you write (C {..}) you may well get
            -- stuff like " 'a' not in scope ", which is a bit silly
            -- if the compiler has just filled in field 'a' of constructor 'C'
        , (Extension
    LangExt.RecordWildCards,     Bool
    turnOn, Extension
    LangExt.DisambiguateRecordFields)

        , (Extension
    LangExt.ParallelArrays, Bool
    turnOn, Extension
    LangExt.ParallelListComp)

        , (Extension
    LangExt.JavaScriptFFI, Bool
    turnOn, Extension
    LangExt.InterruptibleFFI)

        , (Extension
    LangExt.DeriveTraversable, Bool
    turnOn, Extension
    LangExt.DeriveFunctor)
        , (Extension
    LangExt.DeriveTraversable, Bool
    turnOn, Extension
    LangExt.DeriveFoldable)

        -- Duplicate record fields require field disambiguation
        , (Extension
    LangExt.DuplicateRecordFields, Bool
    turnOn, Extension
    LangExt.DisambiguateRecordFields)

        , (Extension
    LangExt.TemplateHaskell, Bool
    turnOn, Extension
    LangExt.TemplateHaskellQuotes)
        , (Extension
    LangExt.Strict, Bool
    turnOn, Extension
    LangExt.StrictData)

        -- Historically only UnboxedTuples was required for unboxed sums to work.
        -- To avoid breaking code, we make UnboxedTuples imply UnboxedSums.
        , (Extension
    LangExt.UnboxedTuples, Bool
    turnOn, Extension
    LangExt.UnboxedSums)

        -- The extensions needed to declare an H98 unlifted data type
        , (Extension
    LangExt.UnliftedDatatypes, Bool
    turnOn, Extension
    LangExt.DataKinds)
        , (Extension
    LangExt.UnliftedDatatypes, Bool
    turnOn, Extension
    LangExt.StandaloneKindSignatures)

        -- See Note [Non-variable pattern bindings aren't linear] in GHC.Tc.Gen.Bind
        , (Extension
    LangExt.LinearTypes, Bool
    turnOn, Extension
    LangExt.MonoLocalBinds)
      ]

    validHoleFitsImpliedGFlags :: [(GeneralFlag, TurnOnFlag, GeneralFlag)]
    validHoleFitsImpliedGFlags :: [(GeneralFlag, Bool, GeneralFlag)]
    validHoleFitsImpliedGFlags
      = [ (GeneralFlag
    Opt_UnclutterValidHoleFits, Bool
    turnOff, GeneralFlag
    Opt_ShowTypeAppOfHoleFits)
        , (GeneralFlag
    Opt_UnclutterValidHoleFits, Bool
    turnOff, GeneralFlag
    Opt_ShowTypeAppVarsOfHoleFits)
        , (GeneralFlag
    Opt_UnclutterValidHoleFits, Bool
    turnOff, GeneralFlag
    Opt_ShowDocsOfHoleFits)
        , (GeneralFlag
    Opt_ShowTypeAppVarsOfHoleFits, Bool
    turnOff, GeneralFlag
    Opt_ShowTypeAppOfHoleFits)
        , (GeneralFlag
    Opt_UnclutterValidHoleFits, Bool
    turnOff, GeneralFlag
    Opt_ShowProvOfHoleFits) ]

    -- General flags that are switched on/off when other general flags are switched
    -- on
    impliedGFlags :: [(GeneralFlag, TurnOnFlag, GeneralFlag)]
    impliedGFlags :: [(GeneralFlag, Bool, GeneralFlag)]
    impliedGFlags = [(GeneralFlag
    Opt_DeferTypeErrors, Bool
    turnOn, GeneralFlag
    Opt_DeferTypedHoles)
                    ,(GeneralFlag
    Opt_DeferTypeErrors, Bool
    turnOn, GeneralFlag
    Opt_DeferOutOfScopeVariables)
                    ,(GeneralFlag
    Opt_DoLinearCoreLinting, Bool
    turnOn, GeneralFlag
    Opt_DoCoreLinting)
                    ,(GeneralFlag
    Opt_Strictness, Bool
    turnOn, GeneralFlag
    Opt_WorkerWrapper)
                    ,(GeneralFlag
    Opt_WriteIfSimplifiedCore, Bool
    turnOn, GeneralFlag
    Opt_WriteInterface)
                    ,(GeneralFlag
    Opt_ByteCodeAndObjectCode, Bool
    turnOn, GeneralFlag
    Opt_WriteIfSimplifiedCore)
                    ,(GeneralFlag
    Opt_InfoTableMap, Bool
    turnOn, GeneralFlag
    Opt_InfoTableMapWithStack)
                    ,(GeneralFlag
    Opt_InfoTableMap, Bool
    turnOn, GeneralFlag
    Opt_InfoTableMapWithFallback)
                    ] [(GeneralFlag, Bool, GeneralFlag)]
    -> [(GeneralFlag, Bool, GeneralFlag)]
    -> [(GeneralFlag, Bool, GeneralFlag)]
    forall a. [a] -> [a] -> [a]
    ++ [(GeneralFlag, Bool, GeneralFlag)]
    validHoleFitsImpliedGFlags

    -- General flags that are switched on/off when other general flags are switched
    -- off
    impliedOffGFlags :: [(GeneralFlag, TurnOnFlag, GeneralFlag)]
    impliedOffGFlags :: [(GeneralFlag, Bool, GeneralFlag)]
    impliedOffGFlags = [(GeneralFlag
    Opt_Strictness, Bool
    turnOff, GeneralFlag
    Opt_WorkerWrapper)]

    -- Please keep what_glasgow_exts_does.rst up to date with this list
    glasgowExtsFlags :: [LangExt.Extension]
    glasgowExtsFlags :: [Extension]
    glasgowExtsFlags = [
                 Extension
    LangExt.ConstrainedClassMethods
               , Extension
    LangExt.DeriveDataTypeable
               , Extension
    LangExt.DeriveFoldable
               , Extension
    LangExt.DeriveFunctor
               , Extension
    LangExt.DeriveGeneric
               , Extension
    LangExt.DeriveTraversable
               , Extension
    LangExt.EmptyDataDecls
               , Extension
    LangExt.ExistentialQuantification
               , Extension
    LangExt.ExplicitNamespaces
               , Extension
    LangExt.FlexibleContexts
               , Extension
    LangExt.FlexibleInstances
               , Extension
    LangExt.ForeignFunctionInterface
               , Extension
    LangExt.FunctionalDependencies
               , Extension
    LangExt.GeneralizedNewtypeDeriving
               , Extension
    LangExt.ImplicitParams
               , Extension
    LangExt.KindSignatures
               , Extension
    LangExt.LiberalTypeSynonyms
               , Extension
    LangExt.MagicHash
               , Extension
    LangExt.MultiParamTypeClasses
               , Extension
    LangExt.ParallelListComp
               , Extension
    LangExt.PatternGuards
               , Extension
    LangExt.PostfixOperators
               , Extension
    LangExt.RankNTypes
               , Extension
    LangExt.RecursiveDo
               , Extension
    LangExt.ScopedTypeVariables
               , Extension
    LangExt.StandaloneDeriving
               , Extension
    LangExt.TypeOperators
               , Extension
    LangExt.TypeSynonymInstances
               , Extension
    LangExt.UnboxedTuples
               , Extension
    LangExt.UnicodeSyntax
               , Extension
    LangExt.UnliftedFFITypes ]

    -- | Debugging flags
    data DumpFlag
    -- See Note [Updating flag description in the User's Guide] in GHC.Driver.Session

       -- debugging flags
       = Opt_D_dump_cmm
       | Opt_D_dump_cmm_from_stg
       | Opt_D_dump_cmm_raw
       | Opt_D_dump_cmm_verbose_by_proc
       -- All of the cmm subflags (there are a lot!) automatically
       -- enabled if you run -ddump-cmm-verbose-by-proc
       -- Each flag corresponds to exact stage of Cmm pipeline.
       | Opt_D_dump_cmm_verbose
       -- same as -ddump-cmm-verbose-by-proc but writes each stage
       -- to a separate file (if used with -ddump-to-file)
       | Opt_D_dump_cmm_cfg
       | Opt_D_dump_cmm_cbe
       | Opt_D_dump_cmm_switch
       | Opt_D_dump_cmm_proc
       | Opt_D_dump_cmm_sp
       | Opt_D_dump_cmm_sink
       | Opt_D_dump_cmm_caf
       | Opt_D_dump_cmm_procmap
       | Opt_D_dump_cmm_split
       | Opt_D_dump_cmm_info
       | Opt_D_dump_cmm_cps
       | Opt_D_dump_cmm_thread_sanitizer
       -- end cmm subflags
       | Opt_D_dump_cfg_weights -- ^ Dump the cfg used for block layout.
       | Opt_D_dump_asm
       | Opt_D_dump_asm_native
       | Opt_D_dump_asm_liveness
       | Opt_D_dump_asm_regalloc
       | Opt_D_dump_asm_regalloc_stages
       | Opt_D_dump_asm_conflicts
       | Opt_D_dump_asm_stats
       | Opt_D_dump_c_backend
       | Opt_D_dump_llvm
       | Opt_D_dump_js
       | Opt_D_dump_core_stats
       | Opt_D_dump_deriv
       | Opt_D_dump_ds
       | Opt_D_dump_ds_preopt
       | Opt_D_dump_foreign
       | Opt_D_dump_inlinings
       | Opt_D_dump_verbose_inlinings
       | Opt_D_dump_rule_firings
       | Opt_D_dump_rule_rewrites
       | Opt_D_dump_simpl_trace
       | Opt_D_dump_occur_anal
       | Opt_D_dump_parsed
       | Opt_D_dump_parsed_ast
       | Opt_D_dump_rn
       | Opt_D_dump_rn_ast
       | Opt_D_dump_simpl
       | Opt_D_dump_simpl_iterations
       | Opt_D_dump_spec
       | Opt_D_dump_spec_constr
       | Opt_D_dump_prep
       | Opt_D_dump_late_cc
       | Opt_D_dump_stg_from_core -- ^ Initial STG (CoreToStg output)
       | Opt_D_dump_stg_unarised  -- ^ STG after unarise
       | Opt_D_dump_stg_cg        -- ^ STG (after stg2stg)
       | Opt_D_dump_stg_tags      -- ^ Result of tag inference analysis.
       | Opt_D_dump_stg_final     -- ^ Final STG (before cmm gen)
       | Opt_D_dump_call_arity
       | Opt_D_dump_exitify
       | Opt_D_dump_dmdanal
       | Opt_D_dump_dmd_signatures
       | Opt_D_dump_cpranal
       | Opt_D_dump_cpr_signatures
       | Opt_D_dump_tc
       | Opt_D_dump_tc_ast
       | Opt_D_dump_hie
       | Opt_D_dump_types
       | Opt_D_dump_rules
       | Opt_D_dump_cse
       | Opt_D_dump_float_out
       | Opt_D_dump_float_in
       | Opt_D_dump_liberate_case
       | Opt_D_dump_static_argument_transformation
       | Opt_D_dump_worker_wrapper
       | Opt_D_dump_rn_trace
       | Opt_D_dump_rn_stats
       | Opt_D_dump_opt_cmm
       | Opt_D_dump_simpl_stats
       | Opt_D_dump_cs_trace -- Constraint solver in type checker
       | Opt_D_dump_tc_trace
       | Opt_D_dump_ec_trace -- Pattern match exhaustiveness checker
       | Opt_D_dump_if_trace
       | Opt_D_dump_splices
       | Opt_D_th_dec_file
       | Opt_D_dump_BCOs
       | Opt_D_dump_ticked
       | Opt_D_dump_rtti
       | Opt_D_source_stats
       | Opt_D_verbose_stg2stg
       | Opt_D_dump_hi
       | Opt_D_dump_hi_diffs
       | Opt_D_dump_mod_cycles
       | Opt_D_dump_mod_map
       | Opt_D_dump_timings
       | Opt_D_dump_view_pattern_commoning
       | Opt_D_verbose_core2core
       | Opt_D_dump_debug
       | Opt_D_dump_json
       | Opt_D_ppr_debug
       | Opt_D_no_debug_output
       | Opt_D_dump_faststrings
       | Opt_D_faststring_stats
       | Opt_D_ipe_stats
       deriving (DumpFlag -> DumpFlag -> Bool
    (DumpFlag -> DumpFlag -> Bool)
    -> (DumpFlag -> DumpFlag -> Bool) -> Eq DumpFlag
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: DumpFlag -> DumpFlag -> Bool
    == :: DumpFlag -> DumpFlag -> Bool
    $c/= :: DumpFlag -> DumpFlag -> Bool
    /= :: DumpFlag -> DumpFlag -> Bool
    Eq, Int -> DumpFlag -> ShowS
    [DumpFlag] -> ShowS
    DumpFlag -> String
    (Int -> DumpFlag -> ShowS)
    -> (DumpFlag -> String) -> ([DumpFlag] -> ShowS) -> Show DumpFlag
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> DumpFlag -> ShowS
    showsPrec :: Int -> DumpFlag -> ShowS
    $cshow :: DumpFlag -> String
    show :: DumpFlag -> String
    $cshowList :: [DumpFlag] -> ShowS
    showList :: [DumpFlag] -> ShowS
    Show, Int -> DumpFlag
    DumpFlag -> Int
    DumpFlag -> [DumpFlag]
    DumpFlag -> DumpFlag
    DumpFlag -> DumpFlag -> [DumpFlag]
    DumpFlag -> DumpFlag -> DumpFlag -> [DumpFlag]
    (DumpFlag -> DumpFlag)
    -> (DumpFlag -> DumpFlag)
    -> (Int -> DumpFlag)
    -> (DumpFlag -> Int)
    -> (DumpFlag -> [DumpFlag])
    -> (DumpFlag -> DumpFlag -> [DumpFlag])
    -> (DumpFlag -> DumpFlag -> [DumpFlag])
    -> (DumpFlag -> DumpFlag -> DumpFlag -> [DumpFlag])
    -> Enum DumpFlag
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: DumpFlag -> DumpFlag
    succ :: DumpFlag -> DumpFlag
    $cpred :: DumpFlag -> DumpFlag
    pred :: DumpFlag -> DumpFlag
    $ctoEnum :: Int -> DumpFlag
    toEnum :: Int -> DumpFlag
    $cfromEnum :: DumpFlag -> Int
    fromEnum :: DumpFlag -> Int
    $cenumFrom :: DumpFlag -> [DumpFlag]
    enumFrom :: DumpFlag -> [DumpFlag]
    $cenumFromThen :: DumpFlag -> DumpFlag -> [DumpFlag]
    enumFromThen :: DumpFlag -> DumpFlag -> [DumpFlag]
    $cenumFromTo :: DumpFlag -> DumpFlag -> [DumpFlag]
    enumFromTo :: DumpFlag -> DumpFlag -> [DumpFlag]
    $cenumFromThenTo :: DumpFlag -> DumpFlag -> DumpFlag -> [DumpFlag]
    enumFromThenTo :: DumpFlag -> DumpFlag -> DumpFlag -> [DumpFlag]
    Enum)

    -- | Helper function to query whether a given `DumpFlag` is enabled or not.
    getDumpFlagFrom
      :: (a -> Int) -- ^ Getter for verbosity setting
      -> (a -> EnumSet DumpFlag) -- ^ Getter for the set of enabled dump flags
      -> DumpFlag -> a -> Bool
    getDumpFlagFrom :: forall a.
    (a -> Int) -> (a -> EnumSet DumpFlag) -> DumpFlag -> a -> Bool
    getDumpFlagFrom a -> Int
    getVerbosity a -> EnumSet DumpFlag
    getFlags DumpFlag
    f a
    x
      =  (DumpFlag
    f DumpFlag -> EnumSet DumpFlag -> Bool
    forall a. Enum a => a -> EnumSet a -> Bool
    `EnumSet.member` a -> EnumSet DumpFlag
    getFlags a
    x)
      Bool -> Bool -> Bool
    || (a -> Int
    getVerbosity a
    x Int -> Int -> Bool
    forall a. Ord a => a -> a -> Bool
    >= Int
    4 Bool -> Bool -> Bool
    && DumpFlag -> Bool
    enabledIfVerbose DumpFlag
    f)

    -- | Is the flag implicitly enabled when the verbosity is high enough?
    enabledIfVerbose :: DumpFlag -> Bool
    enabledIfVerbose :: DumpFlag -> Bool
    enabledIfVerbose DumpFlag
    Opt_D_dump_tc_trace               = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_rn_trace               = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_cs_trace               = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_if_trace               = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_tc                     = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_rn                     = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_rn_stats               = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_hi_diffs               = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_verbose_core2core           = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_verbose_stg2stg             = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_splices                = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_th_dec_file                 = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_rule_firings           = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_rule_rewrites          = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_simpl_trace            = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_rtti                   = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_inlinings              = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_verbose_inlinings      = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_core_stats             = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_asm_stats              = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_types                  = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_simpl_iterations       = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_ticked                 = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_view_pattern_commoning = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_mod_cycles             = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_mod_map                = Bool
    False
    enabledIfVerbose DumpFlag
    Opt_D_dump_ec_trace               = Bool
    False
    enabledIfVerbose DumpFlag
    _                                 = Bool
    True

    -- | Enumerates the simple on-or-off dynamic flags
    data GeneralFlag
    -- See Note [Updating flag description in the User's Guide] in GHC.Driver.Session

       = Opt_DumpToFile                     -- ^ Append dump output to files instead of stdout.
       | Opt_DumpWithWays                   -- ^ Use foo.ways.<dumpFlag> instead of foo.<dumpFlag>
       | Opt_D_dump_minimal_imports
       | Opt_DoCoreLinting
       | Opt_DoLinearCoreLinting
       | Opt_DoStgLinting
       | Opt_DoCmmLinting
       | Opt_DoAsmLinting
       | Opt_DoAnnotationLinting
       | Opt_DoBoundsChecking
       | Opt_NoLlvmMangler                  -- hidden flag
       | Opt_FastLlvm                       -- hidden flag
       | Opt_NoTypeableBinds

       | Opt_DistinctConstructorTables
       | Opt_InfoTableMap
       | Opt_InfoTableMapWithFallback
       | Opt_InfoTableMapWithStack

       | Opt_WarnIsError                    -- -Werror; makes warnings fatal
       | Opt_ShowWarnGroups                 -- Show the group a warning belongs to
       | Opt_HideSourcePaths                -- Hide module source/object paths

       | Opt_PrintExplicitForalls
       | Opt_PrintExplicitKinds
       | Opt_PrintExplicitCoercions
       | Opt_PrintExplicitRuntimeReps
       | Opt_PrintEqualityRelations
       | Opt_PrintAxiomIncomps
       | Opt_PrintUnicodeSyntax
       | Opt_PrintExpandedSynonyms
       | Opt_PrintPotentialInstances
       | Opt_PrintRedundantPromotionTicks
       | Opt_PrintTypecheckerElaboration

       -- optimisation opts
       | Opt_CallArity
       | Opt_Exitification
       | Opt_Strictness
       | Opt_LateDmdAnal                    -- #6087
       | Opt_KillAbsence
       | Opt_KillOneShot
       | Opt_FullLaziness
       | Opt_FloatIn
       | Opt_LocalFloatOut -- ^ Enable floating out of let-bindings in the
                          --   simplifier
       | Opt_LocalFloatOutTopLevel -- ^ Enable floating out of let-bindings at the
                                   --   top level in the simplifier
                                   --   N.B. See Note [RHS Floating]
       | Opt_LateSpecialise
       | Opt_Specialise
       | Opt_SpecialiseAggressively
       | Opt_CrossModuleSpecialise
       | Opt_PolymorphicSpecialisation
       | Opt_InlineGenerics
       | Opt_InlineGenericsAggressively
       | Opt_StaticArgumentTransformation
       | Opt_CSE
       | Opt_StgCSE
       | Opt_StgLiftLams
       | Opt_LiberateCase
       | Opt_SpecConstr
       | Opt_SpecConstrKeen
       | Opt_SpecialiseIncoherents
       | Opt_DoLambdaEtaExpansion
       | Opt_DoCleverArgEtaExpansion        -- See Note [Eta expansion of arguments in CorePrep]
       | Opt_IgnoreAsserts
       | Opt_DoEtaReduction
       | Opt_CaseMerge
       | Opt_CaseFolding                    -- Constant folding through case-expressions
       | Opt_UnboxStrictFields
       | Opt_UnboxSmallStrictFields
       | Opt_DictsCheap
       | Opt_EnableRewriteRules             -- Apply rewrite rules during simplification
       | Opt_EnableThSpliceWarnings         -- Enable warnings for TH splices
       | Opt_RegsGraph                      -- do graph coloring register allocation
       | Opt_RegsIterative                  -- do iterative coalescing graph coloring register allocation
       | Opt_PedanticBottoms                -- Be picky about how we treat bottom
       | Opt_LlvmFillUndefWithGarbage       -- Testing for undef bugs (hidden flag)
       | Opt_IrrefutableTuples
       | Opt_CmmSink
       | Opt_CmmStaticPred
       | Opt_CmmElimCommonBlocks
       | Opt_CmmControlFlow
       | Opt_AsmShortcutting
       | Opt_OmitYields
       | Opt_FunToThunk               -- deprecated
       | Opt_DictsStrict                     -- be strict in argument dictionaries
       | Opt_DmdTxDictSel              -- ^ deprecated, no effect and behaviour is now default.
                                       -- Allowed switching of a special demand transformer for dictionary selectors
       | Opt_Loopification                  -- See Note [Self-recursive tail calls]
       | Opt_CfgBlocklayout             -- ^ Use the cfg based block layout algorithm.
       | Opt_WeightlessBlocklayout         -- ^ Layout based on last instruction per block.
       | Opt_CprAnal
       | Opt_WorkerWrapper
       | Opt_WorkerWrapperUnlift  -- ^ Do W/W split for unlifting even if we won't unbox anything.
       | Opt_SolveConstantDicts
       | Opt_AlignmentSanitisation
       | Opt_CatchNonexhaustiveCases
       | Opt_NumConstantFolding
       | Opt_CoreConstantFolding
       | Opt_FastPAPCalls                  -- #6084
       | Opt_SpecEval
       | Opt_SpecEvalDictFun   -- See Note [Controlling Speculative Evaluation]

       -- Inference flags
       | Opt_DoTagInferenceChecks

       -- PreInlining is on by default. The option is there just to see how
       -- bad things get if you turn it off!
       | Opt_SimplPreInlining

       -- Interface files
       | Opt_IgnoreInterfacePragmas
       | Opt_OmitInterfacePragmas
       | Opt_ExposeAllUnfoldings
       | Opt_ExposeOverloadedUnfoldings
       | Opt_KeepAutoRules -- ^Keep auto-generated rules even if they seem to have become useless
       | Opt_WriteInterface -- forces .hi files to be written even with -fno-code
       | Opt_WriteHie -- generate .hie files

       -- JavaScript opts
       | Opt_DisableJsMinifier -- ^ render JavaScript pretty-printed instead of minified (compacted)
       | Opt_DisableJsCsources -- ^ don't link C sources (compiled to JS) with Haskell code (compiled to JS)

       -- profiling opts
       | Opt_AutoSccsOnIndividualCafs
       | Opt_ProfCountEntries
       | Opt_ProfLateInlineCcs
       | Opt_ProfLateCcs
       | Opt_ProfLateOverloadedCcs
       | Opt_ProfLateoverloadedCallsCCs
       | Opt_ProfManualCcs -- ^ Ignore manual SCC annotations

       -- misc opts
       | Opt_Pp
       | Opt_ForceRecomp
       | Opt_IgnoreOptimChanges
       | Opt_IgnoreHpcChanges
       | Opt_ExcessPrecision
       | Opt_EagerBlackHoling
       | Opt_OrigThunkInfo
       | Opt_NoHsMain
       | Opt_SplitSections
       | Opt_StgStats
       | Opt_HideAllPackages
       | Opt_HideAllPluginPackages
       | Opt_PrintBindResult
       | Opt_Haddock
       | Opt_HaddockOptions
       | Opt_BreakOnException
       | Opt_BreakOnError
       | Opt_PrintEvldWithShow
       | Opt_PrintBindContents
       | Opt_GenManifest
       | Opt_EmbedManifest
       | Opt_SharedImplib
       | Opt_BuildingCabalPackage
       | Opt_IgnoreDotGhci
       | Opt_GhciSandbox
       | Opt_InsertBreakpoints
       | Opt_GhciHistory
       | Opt_GhciLeakCheck
       | Opt_ValidateHie
       | Opt_LocalGhciHistory
       | Opt_NoIt
       | Opt_HelpfulErrors
       | Opt_DeferTypeErrors             -- Since 7.6
       | Opt_DeferTypedHoles             -- Since 7.10
       | Opt_DeferOutOfScopeVariables
       | Opt_PIC                         -- ^ @-fPIC@
       | Opt_PIE                         -- ^ @-fPIE@
       | Opt_PICExecutable               -- ^ @-pie@
       | Opt_ExternalDynamicRefs
       | Opt_Ticky
       | Opt_Ticky_Allocd
       | Opt_Ticky_LNE
       | Opt_Ticky_Dyn_Thunk
       | Opt_Ticky_Tag
       | Opt_Ticky_AP                    -- ^ Use regular thunks even when we could use std ap thunks in order to get entry counts
       | Opt_CmmThreadSanitizer
       | Opt_RPath
       | Opt_RelativeDynlibPaths
       | Opt_CompactUnwind               -- ^ @-fcompact-unwind@
       | Opt_Hpc
       | Opt_FamAppCache
       | Opt_ExternalInterpreter
       | Opt_OptimalApplicativeDo
       | Opt_VersionMacros
       | Opt_WholeArchiveHsLibs
       -- copy all libs into a single folder prior to linking binaries
       -- this should alleviate the excessive command line limit restrictions
       -- on windows, by only requiring a single -L argument instead of
       -- one for each dependency.  At the time of this writing, gcc
       -- forwards all -L flags to the collect2 command without using a
       -- response file and as such breaking apart.
       | Opt_SingleLibFolder
       | Opt_ExposeInternalSymbols
       | Opt_KeepCAFs
       | Opt_KeepGoing
       | Opt_ByteCode
       | Opt_ByteCodeAndObjectCode
       | Opt_UnoptimizedCoreForInterpreter
       | Opt_LinkRts

       -- output style opts
       | Opt_ErrorSpans -- Include full span info in error messages,
                        -- instead of just the start position.
       | Opt_DeferDiagnostics
       | Opt_DiagnosticsAsJSON  -- ^ Dump diagnostics as JSON
       | Opt_DiagnosticsShowCaret -- Show snippets of offending code
       | Opt_PprCaseAsLet
       | Opt_PprShowTicks
       | Opt_ShowHoleConstraints
        -- Options relating to the display of valid hole fits
        -- when generating an error message for a typed hole
        -- See Note [Valid hole fits include ...] in GHC.Tc.Errors.Hole
       | Opt_ShowValidHoleFits
       | Opt_SortValidHoleFits
       | Opt_SortBySizeHoleFits
       | Opt_SortBySubsumHoleFits
       | Opt_AbstractRefHoleFits
       | Opt_UnclutterValidHoleFits
       | Opt_ShowTypeAppOfHoleFits
       | Opt_ShowTypeAppVarsOfHoleFits
       | Opt_ShowDocsOfHoleFits
       | Opt_ShowTypeOfHoleFits
       | Opt_ShowProvOfHoleFits
       | Opt_ShowMatchesOfHoleFits

       | Opt_ShowLoadedModules
       | Opt_HexWordLiterals -- See Note [Print Hexadecimal Literals]

       -- Suppress a coercions inner structure, replacing it with '...'
       | Opt_SuppressCoercions
       -- Suppress the type of a coercion as well
       | Opt_SuppressCoercionTypes
       | Opt_SuppressVarKinds
       -- Suppress module id prefixes on variables.
       | Opt_SuppressModulePrefixes
       -- Suppress type applications.
       | Opt_SuppressTypeApplications
       -- Suppress info such as arity and unfoldings on identifiers.
       | Opt_SuppressIdInfo
       -- Suppress separate type signatures in core, but leave types on
       -- lambda bound vars
       | Opt_SuppressUnfoldings
       -- Suppress the details of even stable unfoldings
       | Opt_SuppressTypeSignatures
       -- Suppress unique ids on variables.
       -- Except for uniques, as some simplifier phases introduce new
       -- variables that have otherwise identical names.
       | Opt_SuppressUniques
       | Opt_SuppressStgExts
       | Opt_SuppressStgReps
       | Opt_SuppressTicks     -- Replaces Opt_PprShowTicks
       | Opt_SuppressTimestamps -- ^ Suppress timestamps in dumps
       | Opt_SuppressCoreSizes  -- ^ Suppress per binding Core size stats in dumps

       -- Error message suppression
       | Opt_ShowErrorContext

       -- Object code determinism
       | Opt_ObjectDeterminism

       -- temporary flags
       | Opt_AutoLinkPackages
       | Opt_ImplicitImportQualified

       -- keeping stuff
       | Opt_KeepHscppFiles
       | Opt_KeepHiDiffs
       | Opt_KeepHcFiles
       | Opt_KeepSFiles
       | Opt_KeepTmpFiles
       | Opt_KeepRawTokenStream
       | Opt_KeepLlvmFiles
       | Opt_KeepHiFiles
       | Opt_KeepOFiles

       | Opt_BuildDynamicToo
       | Opt_WriteIfSimplifiedCore
       | Opt_UseBytecodeRatherThanObjects

       -- safe haskell flags
       | Opt_DistrustAllPackages
       | Opt_PackageTrust
       | Opt_PluginTrustworthy

       | Opt_G_NoStateHack
       | Opt_G_NoOptCoercion
       deriving (GeneralFlag -> GeneralFlag -> Bool
    (GeneralFlag -> GeneralFlag -> Bool)
    -> (GeneralFlag -> GeneralFlag -> Bool) -> Eq GeneralFlag
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: GeneralFlag -> GeneralFlag -> Bool
    == :: GeneralFlag -> GeneralFlag -> Bool
    $c/= :: GeneralFlag -> GeneralFlag -> Bool
    /= :: GeneralFlag -> GeneralFlag -> Bool
    Eq, Int -> GeneralFlag -> ShowS
    [GeneralFlag] -> ShowS
    GeneralFlag -> String
    (Int -> GeneralFlag -> ShowS)
    -> (GeneralFlag -> String)
    -> ([GeneralFlag] -> ShowS)
    -> Show GeneralFlag
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> GeneralFlag -> ShowS
    showsPrec :: Int -> GeneralFlag -> ShowS
    $cshow :: GeneralFlag -> String
    show :: GeneralFlag -> String
    $cshowList :: [GeneralFlag] -> ShowS
    showList :: [GeneralFlag] -> ShowS
    Show, Int -> GeneralFlag
    GeneralFlag -> Int
    GeneralFlag -> [GeneralFlag]
    GeneralFlag -> GeneralFlag
    GeneralFlag -> GeneralFlag -> [GeneralFlag]
    GeneralFlag -> GeneralFlag -> GeneralFlag -> [GeneralFlag]
    (GeneralFlag -> GeneralFlag)
    -> (GeneralFlag -> GeneralFlag)
    -> (Int -> GeneralFlag)
    -> (GeneralFlag -> Int)
    -> (GeneralFlag -> [GeneralFlag])
    -> (GeneralFlag -> GeneralFlag -> [GeneralFlag])
    -> (GeneralFlag -> GeneralFlag -> [GeneralFlag])
    -> (GeneralFlag -> GeneralFlag -> GeneralFlag -> [GeneralFlag])
    -> Enum GeneralFlag
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: GeneralFlag -> GeneralFlag
    succ :: GeneralFlag -> GeneralFlag
    $cpred :: GeneralFlag -> GeneralFlag
    pred :: GeneralFlag -> GeneralFlag
    $ctoEnum :: Int -> GeneralFlag
    toEnum :: Int -> GeneralFlag
    $cfromEnum :: GeneralFlag -> Int
    fromEnum :: GeneralFlag -> Int
    $cenumFrom :: GeneralFlag -> [GeneralFlag]
    enumFrom :: GeneralFlag -> [GeneralFlag]
    $cenumFromThen :: GeneralFlag -> GeneralFlag -> [GeneralFlag]
    enumFromThen :: GeneralFlag -> GeneralFlag -> [GeneralFlag]
    $cenumFromTo :: GeneralFlag -> GeneralFlag -> [GeneralFlag]
    enumFromTo :: GeneralFlag -> GeneralFlag -> [GeneralFlag]
    $cenumFromThenTo :: GeneralFlag -> GeneralFlag -> GeneralFlag -> [GeneralFlag]
    enumFromThenTo :: GeneralFlag -> GeneralFlag -> GeneralFlag -> [GeneralFlag]
    Enum)

    -- | The set of flags which affect optimisation for the purposes of
    -- recompilation avoidance. Specifically, these include flags which
    -- affect code generation but not the semantics of the program.
    --
    -- See Note [Ignoring some flag changes] in GHC.Iface.Recomp.Flags)
    optimisationFlags :: EnumSet GeneralFlag
    optimisationFlags :: EnumSet GeneralFlag
    optimisationFlags = [GeneralFlag] -> EnumSet GeneralFlag
    forall a. Enum a => [a] -> EnumSet a
    EnumSet.fromList
       [ GeneralFlag
    Opt_CallArity
       , GeneralFlag
    Opt_Strictness
       , GeneralFlag
    Opt_LateDmdAnal
       , GeneralFlag
    Opt_KillAbsence
       , GeneralFlag
    Opt_KillOneShot
       , GeneralFlag
    Opt_FullLaziness
       , GeneralFlag
    Opt_FloatIn
       , GeneralFlag
    Opt_LateSpecialise
       , GeneralFlag
    Opt_Specialise
       , GeneralFlag
    Opt_SpecialiseAggressively
       , GeneralFlag
    Opt_CrossModuleSpecialise
       , GeneralFlag
    Opt_StaticArgumentTransformation
       , GeneralFlag
    Opt_CSE
       , GeneralFlag
    Opt_StgCSE
       , GeneralFlag
    Opt_StgLiftLams
       , GeneralFlag
    Opt_LiberateCase
       , GeneralFlag
    Opt_SpecConstr
       , GeneralFlag
    Opt_SpecConstrKeen
       , GeneralFlag
    Opt_DoLambdaEtaExpansion
       , GeneralFlag
    Opt_IgnoreAsserts
       , GeneralFlag
    Opt_DoEtaReduction
       , GeneralFlag
    Opt_CaseMerge
       , GeneralFlag
    Opt_CaseFolding
       , GeneralFlag
    Opt_UnboxStrictFields
       , GeneralFlag
    Opt_UnboxSmallStrictFields
       , GeneralFlag
    Opt_DictsCheap
       , GeneralFlag
    Opt_EnableRewriteRules
       , GeneralFlag
    Opt_RegsGraph
       , GeneralFlag
    Opt_RegsIterative
       , GeneralFlag
    Opt_IrrefutableTuples
       , GeneralFlag
    Opt_CmmSink
       , GeneralFlag
    Opt_CmmElimCommonBlocks
       , GeneralFlag
    Opt_AsmShortcutting
       , GeneralFlag
    Opt_FunToThunk
       , GeneralFlag
    Opt_DmdTxDictSel
       , GeneralFlag
    Opt_Loopification
       , GeneralFlag
    Opt_CfgBlocklayout
       , GeneralFlag
    Opt_WeightlessBlocklayout
       , GeneralFlag
    Opt_CprAnal
       , GeneralFlag
    Opt_WorkerWrapper
       , GeneralFlag
    Opt_WorkerWrapperUnlift
       , GeneralFlag
    Opt_SolveConstantDicts
       , GeneralFlag
    Opt_SpecEval
       , GeneralFlag
    Opt_SpecEvalDictFun
       ]

    -- | The set of flags which affect code generation and can change a program's
    -- runtime behavior (other than performance). These include flags which affect:
    --
    --  * user visible debugging information (e.g. info table provenance)
    --  * the ability to catch runtime errors (e.g. -fignore-asserts)
    --  * the runtime result of the program (e.g. -fomit-yields)
    --  * which code or interface file declarations are emitted
    --
    -- We also considered placing flags which affect asympototic space behavior
    -- (e.g. -ffull-laziness) however this would mean that changing optimisation
    -- levels would trigger recompilation even with -fignore-optim-changes,
    -- regressing #13604.
    --
    -- Also, arguably Opt_IgnoreAsserts should be here as well; however, we place
    -- it instead in 'optimisationFlags' since it is implied by @-O[12]@ and
    -- therefore would also break #13604.
    --
    -- See #23369.
    codeGenFlags :: EnumSet GeneralFlag
    codeGenFlags :: EnumSet GeneralFlag
    codeGenFlags = [GeneralFlag] -> EnumSet GeneralFlag
    forall a. Enum a => [a] -> EnumSet a
    EnumSet.fromList
       [ -- Flags that affect runtime result
         GeneralFlag
    Opt_EagerBlackHoling
       , GeneralFlag
    Opt_ExcessPrecision
       , GeneralFlag
    Opt_DictsStrict
       , GeneralFlag
    Opt_PedanticBottoms
       , GeneralFlag
    Opt_OmitYields

         -- Flags that affect generated code
       , GeneralFlag
    Opt_ExposeAllUnfoldings
       , GeneralFlag
    Opt_ExposeOverloadedUnfoldings
       , GeneralFlag
    Opt_NoTypeableBinds
       , GeneralFlag
    Opt_ObjectDeterminism
       , GeneralFlag
    Opt_Haddock

         -- Flags that affect catching of runtime errors
       , GeneralFlag
    Opt_CatchNonexhaustiveCases
       , GeneralFlag
    Opt_LlvmFillUndefWithGarbage
       , GeneralFlag
    Opt_DoTagInferenceChecks

         -- Flags that affect debugging information
       , GeneralFlag
    Opt_DistinctConstructorTables
       , GeneralFlag
    Opt_InfoTableMap
       , GeneralFlag
    Opt_InfoTableMapWithStack
       , GeneralFlag
    Opt_InfoTableMapWithFallback
       , GeneralFlag
    Opt_OrigThunkInfo
       ]

    data WarningFlag =
    -- See Note [Updating flag description in the User's Guide] in GHC.Driver.Session
         Opt_WarnDuplicateExports
       | Opt_WarnDuplicateConstraints
       | Opt_WarnRedundantConstraints
       | Opt_WarnHiShadows
       | Opt_WarnImplicitPrelude
       | Opt_WarnIncompletePatterns
       | Opt_WarnIncompleteUniPatterns
       | Opt_WarnIncompletePatternsRecUpd
       | Opt_WarnOverflowedLiterals
       | Opt_WarnEmptyEnumerations
       | Opt_WarnMissingFields
       | Opt_WarnMissingImportList
       | Opt_WarnMissingMethods
       | Opt_WarnMissingSignatures
       | Opt_WarnMissingLocalSignatures
       | Opt_WarnNameShadowing
       | Opt_WarnOverlappingPatterns
       | Opt_WarnTypeDefaults
       | Opt_WarnMonomorphism
       | Opt_WarnUnusedTopBinds
       | Opt_WarnUnusedLocalBinds
       | Opt_WarnUnusedPatternBinds
       | Opt_WarnUnusedImports
       | Opt_WarnUnusedMatches
       | Opt_WarnUnusedTypePatterns
       | Opt_WarnUnusedForalls
       | Opt_WarnUnusedRecordWildcards
       | Opt_WarnRedundantBangPatterns
       | Opt_WarnRedundantRecordWildcards
       | Opt_WarnDeprecatedFlags
       | Opt_WarnMissingMonadFailInstances               -- since 8.0, has no effect since 8.8
       | Opt_WarnSemigroup                               -- since 8.0, has no effect since 9.8
       | Opt_WarnDodgyExports
       | Opt_WarnDodgyImports
       | Opt_WarnOrphans
       | Opt_WarnAutoOrphans
       | Opt_WarnIdentities
       | Opt_WarnTabs
       | Opt_WarnUnrecognisedPragmas
       | Opt_WarnMisplacedPragmas
       | Opt_WarnDodgyForeignImports
       | Opt_WarnUnusedDoBind
       | Opt_WarnWrongDoBind
       | Opt_WarnAlternativeLayoutRuleTransitional
       | Opt_WarnUnsafe
       | Opt_WarnSafe
       | Opt_WarnTrustworthySafe
       | Opt_WarnMissedSpecs
       | Opt_WarnAllMissedSpecs
       | Opt_WarnUnsupportedCallingConventions
       | Opt_WarnUnsupportedLlvmVersion
       | Opt_WarnMissedExtraSharedLib
       | Opt_WarnInlineRuleShadowing
       | Opt_WarnTypedHoles
       | Opt_WarnPartialTypeSignatures
       | Opt_WarnMissingExportedSignatures
       | Opt_WarnUntickedPromotedConstructors
       | Opt_WarnDerivingTypeable
       | Opt_WarnDeferredTypeErrors
       | Opt_WarnDeferredOutOfScopeVariables
       | Opt_WarnNonCanonicalMonadInstances              -- since 8.0
       | Opt_WarnNonCanonicalMonadFailInstances          -- since 8.0, removed 8.8
       | Opt_WarnNonCanonicalMonoidInstances             -- since 8.0
       | Opt_WarnMissingPatternSynonymSignatures         -- since 8.0
       | Opt_WarnUnrecognisedWarningFlags                -- since 8.0
       | Opt_WarnSimplifiableClassConstraints            -- Since 8.2
       | Opt_WarnCPPUndef                                -- Since 8.2
       | Opt_WarnUnbangedStrictPatterns                  -- Since 8.2
       | Opt_WarnMissingHomeModules                      -- Since 8.2
       | Opt_WarnPartialFields                           -- Since 8.4
       | Opt_WarnMissingExportList
       | Opt_WarnInaccessibleCode
       | Opt_WarnStarIsType                              -- Since 8.6
       | Opt_WarnStarBinder                              -- Since 8.6
       | Opt_WarnImplicitKindVars                        -- Since 8.6
       | Opt_WarnSpaceAfterBang
       | Opt_WarnMissingDerivingStrategies               -- Since 8.8
       | Opt_WarnPrepositiveQualifiedModule              -- Since 8.10
       | Opt_WarnUnusedPackages                          -- Since 8.10
       | Opt_WarnInferredSafeImports                     -- Since 8.10
       | Opt_WarnMissingSafeHaskellMode                  -- Since 8.10
       | Opt_WarnCompatUnqualifiedImports                -- Since 8.10
       | Opt_WarnDerivingDefaults
       | Opt_WarnInvalidHaddock                          -- Since 9.0
       | Opt_WarnOperatorWhitespaceExtConflict           -- Since 9.2
       | Opt_WarnOperatorWhitespace                      -- Since 9.2
       | Opt_WarnAmbiguousFields                         -- Since 9.2
       | Opt_WarnImplicitLift                            -- Since 9.2
       | Opt_WarnMissingKindSignatures                   -- Since 9.2
       | Opt_WarnMissingPolyKindSignatures               -- Since 9.8
       | Opt_WarnMissingExportedPatternSynonymSignatures -- since 9.2
       | Opt_WarnRedundantStrictnessFlags                -- Since 9.4
       | Opt_WarnForallIdentifier                        -- Since 9.4
       | Opt_WarnUnicodeBidirectionalFormatCharacters    -- Since 9.0.2
       | Opt_WarnGADTMonoLocalBinds                      -- Since 9.4
       | Opt_WarnTypeEqualityOutOfScope                  -- Since 9.4
       | Opt_WarnTypeEqualityRequiresOperators           -- Since 9.4
       | Opt_WarnLoopySuperclassSolve                    -- Since 9.6, has no effect since 9.10
       | Opt_WarnTermVariableCapture                     -- Since 9.8
       | Opt_WarnMissingRoleAnnotations                  -- Since 9.8
       | Opt_WarnImplicitRhsQuantification               -- Since 9.8
       | Opt_WarnIncompleteExportWarnings                -- Since 9.8
       | Opt_WarnIncompleteRecordSelectors               -- Since 9.10
       | Opt_WarnBadlyStagedTypes                        -- Since 9.10
       | Opt_WarnInconsistentFlags                       -- Since 9.8
       | Opt_WarnDataKindsTC                             -- Since 9.10
       | Opt_WarnDeprecatedTypeAbstractions              -- Since 9.10
       | Opt_WarnDefaultedExceptionContext               -- Since 9.10
       | Opt_WarnViewPatternSignatures                   -- Since 9.12
       deriving (WarningFlag -> WarningFlag -> Bool
    (WarningFlag -> WarningFlag -> Bool)
    -> (WarningFlag -> WarningFlag -> Bool) -> Eq WarningFlag
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: WarningFlag -> WarningFlag -> Bool
    == :: WarningFlag -> WarningFlag -> Bool
    $c/= :: WarningFlag -> WarningFlag -> Bool
    /= :: WarningFlag -> WarningFlag -> Bool
    Eq, Eq WarningFlag
    Eq WarningFlag =>
    (WarningFlag -> WarningFlag -> Ordering)
    -> (WarningFlag -> WarningFlag -> Bool)
    -> (WarningFlag -> WarningFlag -> Bool)
    -> (WarningFlag -> WarningFlag -> Bool)
    -> (WarningFlag -> WarningFlag -> Bool)
    -> (WarningFlag -> WarningFlag -> WarningFlag)
    -> (WarningFlag -> WarningFlag -> WarningFlag)
    -> Ord WarningFlag
    WarningFlag -> WarningFlag -> Bool
    WarningFlag -> WarningFlag -> Ordering
    WarningFlag -> WarningFlag -> WarningFlag
    forall a.
    Eq a =>
    (a -> a -> Ordering)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> Bool)
    -> (a -> a -> a)
    -> (a -> a -> a)
    -> Ord a
    $ccompare :: WarningFlag -> WarningFlag -> Ordering
    compare :: WarningFlag -> WarningFlag -> Ordering
    $c< :: WarningFlag -> WarningFlag -> Bool
    < :: WarningFlag -> WarningFlag -> Bool
    $c<= :: WarningFlag -> WarningFlag -> Bool
    <= :: WarningFlag -> WarningFlag -> Bool
    $c> :: WarningFlag -> WarningFlag -> Bool
    > :: WarningFlag -> WarningFlag -> Bool
    $c>= :: WarningFlag -> WarningFlag -> Bool
    >= :: WarningFlag -> WarningFlag -> Bool
    $cmax :: WarningFlag -> WarningFlag -> WarningFlag
    max :: WarningFlag -> WarningFlag -> WarningFlag
    $cmin :: WarningFlag -> WarningFlag -> WarningFlag
    min :: WarningFlag -> WarningFlag -> WarningFlag
    Ord, Int -> WarningFlag -> ShowS
    [WarningFlag] -> ShowS
    WarningFlag -> String
    (Int -> WarningFlag -> ShowS)
    -> (WarningFlag -> String)
    -> ([WarningFlag] -> ShowS)
    -> Show WarningFlag
    forall a.
    (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
    $cshowsPrec :: Int -> WarningFlag -> ShowS
    showsPrec :: Int -> WarningFlag -> ShowS
    $cshow :: WarningFlag -> String
    show :: WarningFlag -> String
    $cshowList :: [WarningFlag] -> ShowS
    showList :: [WarningFlag] -> ShowS
    Show, Int -> WarningFlag
    WarningFlag -> Int
    WarningFlag -> [WarningFlag]
    WarningFlag -> WarningFlag
    WarningFlag -> WarningFlag -> [WarningFlag]
    WarningFlag -> WarningFlag -> WarningFlag -> [WarningFlag]
    (WarningFlag -> WarningFlag)
    -> (WarningFlag -> WarningFlag)
    -> (Int -> WarningFlag)
    -> (WarningFlag -> Int)
    -> (WarningFlag -> [WarningFlag])
    -> (WarningFlag -> WarningFlag -> [WarningFlag])
    -> (WarningFlag -> WarningFlag -> [WarningFlag])
    -> (WarningFlag -> WarningFlag -> WarningFlag -> [WarningFlag])
    -> Enum WarningFlag
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: WarningFlag -> WarningFlag
    succ :: WarningFlag -> WarningFlag
    $cpred :: WarningFlag -> WarningFlag
    pred :: WarningFlag -> WarningFlag
    $ctoEnum :: Int -> WarningFlag
    toEnum :: Int -> WarningFlag
    $cfromEnum :: WarningFlag -> Int
    fromEnum :: WarningFlag -> Int
    $cenumFrom :: WarningFlag -> [WarningFlag]
    enumFrom :: WarningFlag -> [WarningFlag]
    $cenumFromThen :: WarningFlag -> WarningFlag -> [WarningFlag]
    enumFromThen :: WarningFlag -> WarningFlag -> [WarningFlag]
    $cenumFromTo :: WarningFlag -> WarningFlag -> [WarningFlag]
    enumFromTo :: WarningFlag -> WarningFlag -> [WarningFlag]
    $cenumFromThenTo :: WarningFlag -> WarningFlag -> WarningFlag -> [WarningFlag]
    enumFromThenTo :: WarningFlag -> WarningFlag -> WarningFlag -> [WarningFlag]
    Enum, WarningFlag
    WarningFlag -> WarningFlag -> Bounded WarningFlag
    forall a. a -> a -> Bounded a
    $cminBound :: WarningFlag
    minBound :: WarningFlag
    $cmaxBound :: WarningFlag
    maxBound :: WarningFlag
    Bounded)

    -- | Return the names of a WarningFlag
    --
    -- One flag may have several names because of US/UK spelling.  The first one is
    -- the "preferred one" that will be displayed in warning messages.
    warnFlagNames :: WarningFlag -> NonEmpty String
    warnFlagNames :: WarningFlag -> NonEmpty String
    warnFlagNames WarningFlag
    wflag = case WarningFlag
    wflag of
      WarningFlag
    Opt_WarnAlternativeLayoutRuleTransitional       -> String
    "alternative-layout-rule-transitional" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnAmbiguousFields                         -> String
    "ambiguous-fields" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnAutoOrphans                             -> String
    "auto-orphans" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnTermVariableCapture                     -> String
    "term-variable-capture" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnCPPUndef                                -> String
    "cpp-undef" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnbangedStrictPatterns                  -> String
    "unbanged-strict-patterns" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDeferredTypeErrors                      -> String
    "deferred-type-errors" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDeferredOutOfScopeVariables             -> String
    "deferred-out-of-scope-variables" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDeprecatedFlags                         -> String
    "deprecated-flags" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDerivingDefaults                        -> String
    "deriving-defaults" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDerivingTypeable                        -> String
    "deriving-typeable" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDodgyExports                            -> String
    "dodgy-exports" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDodgyForeignImports                     -> String
    "dodgy-foreign-imports" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDodgyImports                            -> String
    "dodgy-imports" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnEmptyEnumerations                       -> String
    "empty-enumerations" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDuplicateConstraints                    -> String
    "duplicate-constraints" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnRedundantConstraints                    -> String
    "redundant-constraints" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDuplicateExports                        -> String
    "duplicate-exports" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnHiShadows                               -> String
    "hi-shadowing" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnInaccessibleCode                        -> String
    "inaccessible-code" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnImplicitPrelude                         -> String
    "implicit-prelude" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnImplicitKindVars                        -> String
    "implicit-kind-vars" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnIncompletePatterns                      -> String
    "incomplete-patterns" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnIncompletePatternsRecUpd                -> String
    "incomplete-record-updates" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnIncompleteUniPatterns                   -> String
    "incomplete-uni-patterns" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnInlineRuleShadowing                     -> String
    "inline-rule-shadowing" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnIdentities                              -> String
    "identities" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingFields                           -> String
    "missing-fields" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingImportList                       -> String
    "missing-import-lists" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingExportList                       -> String
    "missing-export-lists" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingLocalSignatures                  -> String
    "missing-local-signatures" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingMethods                          -> String
    "missing-methods" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingMonadFailInstances               -> String
    "missing-monadfail-instances" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnSemigroup                               -> String
    "semigroup" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingSignatures                       -> String
    "missing-signatures" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingKindSignatures                   -> String
    "missing-kind-signatures" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingPolyKindSignatures               -> String
    "missing-poly-kind-signatures" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingExportedSignatures               -> String
    "missing-exported-signatures" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMonomorphism                            -> String
    "monomorphism-restriction" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnNameShadowing                           -> String
    "name-shadowing" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnNonCanonicalMonadInstances              -> String
    "noncanonical-monad-instances" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnNonCanonicalMonadFailInstances          -> String
    "noncanonical-monadfail-instances" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnNonCanonicalMonoidInstances             -> String
    "noncanonical-monoid-instances" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnOrphans                                 -> String
    "orphans" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnOverflowedLiterals                      -> String
    "overflowed-literals" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnOverlappingPatterns                     -> String
    "overlapping-patterns" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissedSpecs                             -> String
    "missed-specialisations" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| [String
    "missed-specializations"]
      WarningFlag
    Opt_WarnAllMissedSpecs                          -> String
    "all-missed-specialisations" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| [String
    "all-missed-specializations"]
      WarningFlag
    Opt_WarnSafe                                    -> String
    "safe" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnTrustworthySafe                         -> String
    "trustworthy-safe" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnInferredSafeImports                     -> String
    "inferred-safe-imports" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingSafeHaskellMode                  -> String
    "missing-safe-haskell-mode" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnTabs                                    -> String
    "tabs" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnTypeDefaults                            -> String
    "type-defaults" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnTypedHoles                              -> String
    "typed-holes" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnPartialTypeSignatures                   -> String
    "partial-type-signatures" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnrecognisedPragmas                     -> String
    "unrecognised-pragmas" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMisplacedPragmas                        -> String
    "misplaced-pragmas" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnsafe                                  -> String
    "unsafe" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnsupportedCallingConventions           -> String
    "unsupported-calling-conventions" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnsupportedLlvmVersion                  -> String
    "unsupported-llvm-version" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissedExtraSharedLib                    -> String
    "missed-extra-shared-lib" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUntickedPromotedConstructors            -> String
    "unticked-promoted-constructors" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnusedDoBind                            -> String
    "unused-do-bind" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnusedForalls                           -> String
    "unused-foralls" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnusedImports                           -> String
    "unused-imports" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnusedLocalBinds                        -> String
    "unused-local-binds" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnusedMatches                           -> String
    "unused-matches" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnusedPatternBinds                      -> String
    "unused-pattern-binds" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnusedTopBinds                          -> String
    "unused-top-binds" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnusedTypePatterns                      -> String
    "unused-type-patterns" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnusedRecordWildcards                   -> String
    "unused-record-wildcards" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnRedundantBangPatterns                   -> String
    "redundant-bang-patterns" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnRedundantRecordWildcards                -> String
    "redundant-record-wildcards" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnRedundantStrictnessFlags                -> String
    "redundant-strictness-flags" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnWrongDoBind                             -> String
    "wrong-do-bind" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingPatternSynonymSignatures         -> String
    "missing-pattern-synonym-signatures" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingDerivingStrategies               -> String
    "missing-deriving-strategies" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnSimplifiableClassConstraints            -> String
    "simplifiable-class-constraints" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingHomeModules                      -> String
    "missing-home-modules" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnrecognisedWarningFlags                -> String
    "unrecognised-warning-flags" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnStarBinder                              -> String
    "star-binder" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnStarIsType                              -> String
    "star-is-type" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnSpaceAfterBang                          -> String
    "missing-space-after-bang" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnPartialFields                           -> String
    "partial-fields" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnPrepositiveQualifiedModule              -> String
    "prepositive-qualified-module" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnusedPackages                          -> String
    "unused-packages" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnCompatUnqualifiedImports                -> String
    "compat-unqualified-imports" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnInvalidHaddock                          -> String
    "invalid-haddock" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnOperatorWhitespaceExtConflict           -> String
    "operator-whitespace-ext-conflict" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnOperatorWhitespace                      -> String
    "operator-whitespace" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnImplicitLift                            -> String
    "implicit-lift" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingExportedPatternSynonymSignatures -> String
    "missing-exported-pattern-synonym-signatures" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnForallIdentifier                        -> String
    "forall-identifier" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnUnicodeBidirectionalFormatCharacters    -> String
    "unicode-bidirectional-format-characters" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnGADTMonoLocalBinds                      -> String
    "gadt-mono-local-binds" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnTypeEqualityOutOfScope                  -> String
    "type-equality-out-of-scope" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnLoopySuperclassSolve                    -> String
    "loopy-superclass-solve" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnTypeEqualityRequiresOperators           -> String
    "type-equality-requires-operators" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnMissingRoleAnnotations                  -> String
    "missing-role-annotations" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnImplicitRhsQuantification               -> String
    "implicit-rhs-quantification" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnIncompleteExportWarnings                -> String
    "incomplete-export-warnings" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnIncompleteRecordSelectors               -> String
    "incomplete-record-selectors" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnBadlyStagedTypes                        -> String
    "badly-staged-types" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnInconsistentFlags                       -> String
    "inconsistent-flags" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDataKindsTC                             -> String
    "data-kinds-tc" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDeprecatedTypeAbstractions              -> String
    "deprecated-type-abstractions" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnDefaultedExceptionContext               -> String
    "defaulted-exception-context" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []
      WarningFlag
    Opt_WarnViewPatternSignatures                   -> String
    "view-pattern-signatures" String -> [String] -> NonEmpty String
    forall a. a -> [a] -> NonEmpty a
    :| []

    -- -----------------------------------------------------------------------------
    -- Standard sets of warning options

    -- Note [Documenting warning flags]
    -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    --
    -- If you change the list of warnings enabled by default
    -- please remember to update the User's Guide. The relevant file is:
    --
    --  docs/users_guide/using-warnings.rst

    -- | A group of warning flags that can be enabled or disabled collectively,
    -- e.g. using @-Wcompat@ to enable all warnings in the 'W_compat' group.
    data WarningGroup = W_compat
                      | W_unused_binds
                      | W_extended_warnings
                      | W_default
                      | W_extra
                      | W_all
                      | W_everything
      deriving (WarningGroup
    WarningGroup -> WarningGroup -> Bounded WarningGroup
    forall a. a -> a -> Bounded a
    $cminBound :: WarningGroup
    minBound :: WarningGroup
    $cmaxBound :: WarningGroup
    maxBound :: WarningGroup
    Bounded, Int -> WarningGroup
    WarningGroup -> Int
    WarningGroup -> [WarningGroup]
    WarningGroup -> WarningGroup
    WarningGroup -> WarningGroup -> [WarningGroup]
    WarningGroup -> WarningGroup -> WarningGroup -> [WarningGroup]
    (WarningGroup -> WarningGroup)
    -> (WarningGroup -> WarningGroup)
    -> (Int -> WarningGroup)
    -> (WarningGroup -> Int)
    -> (WarningGroup -> [WarningGroup])
    -> (WarningGroup -> WarningGroup -> [WarningGroup])
    -> (WarningGroup -> WarningGroup -> [WarningGroup])
    -> (WarningGroup -> WarningGroup -> WarningGroup -> [WarningGroup])
    -> Enum WarningGroup
    forall a.
    (a -> a)
    -> (a -> a)
    -> (Int -> a)
    -> (a -> Int)
    -> (a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> [a])
    -> (a -> a -> a -> [a])
    -> Enum a
    $csucc :: WarningGroup -> WarningGroup
    succ :: WarningGroup -> WarningGroup
    $cpred :: WarningGroup -> WarningGroup
    pred :: WarningGroup -> WarningGroup
    $ctoEnum :: Int -> WarningGroup
    toEnum :: Int -> WarningGroup
    $cfromEnum :: WarningGroup -> Int
    fromEnum :: WarningGroup -> Int
    $cenumFrom :: WarningGroup -> [WarningGroup]
    enumFrom :: WarningGroup -> [WarningGroup]
    $cenumFromThen :: WarningGroup -> WarningGroup -> [WarningGroup]
    enumFromThen :: WarningGroup -> WarningGroup -> [WarningGroup]
    $cenumFromTo :: WarningGroup -> WarningGroup -> [WarningGroup]
    enumFromTo :: WarningGroup -> WarningGroup -> [WarningGroup]
    $cenumFromThenTo :: WarningGroup -> WarningGroup -> WarningGroup -> [WarningGroup]
    enumFromThenTo :: WarningGroup -> WarningGroup -> WarningGroup -> [WarningGroup]
    Enum, WarningGroup -> WarningGroup -> Bool
    (WarningGroup -> WarningGroup -> Bool)
    -> (WarningGroup -> WarningGroup -> Bool) -> Eq WarningGroup
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    $c== :: WarningGroup -> WarningGroup -> Bool
    == :: WarningGroup -> WarningGroup -> Bool
    $c/= :: WarningGroup -> WarningGroup -> Bool
    /= :: WarningGroup -> WarningGroup -> Bool
    Eq)

    warningGroupName :: WarningGroup -> String
    warningGroupName :: WarningGroup -> String
    warningGroupName WarningGroup
    W_compat            = String
    "compat"
    warningGroupName WarningGroup
    W_unused_binds      = String
    "unused-binds"
    warningGroupName WarningGroup
    W_extended_warnings = String
    "extended-warnings"
    warningGroupName WarningGroup
    W_default           = String
    "default"
    warningGroupName WarningGroup
    W_extra             = String
    "extra"
    warningGroupName WarningGroup
    W_all               = String
    "all"
    warningGroupName WarningGroup
    W_everything        = String
    "everything"

    warningGroupFlags :: WarningGroup -> [WarningFlag]
    warningGroupFlags :: WarningGroup -> [WarningFlag]
    warningGroupFlags WarningGroup
    W_compat            = [WarningFlag]
    minusWcompatOpts
    warningGroupFlags WarningGroup
    W_unused_binds      = [WarningFlag]
    unusedBindsFlags
    warningGroupFlags WarningGroup
    W_extended_warnings = []
    warningGroupFlags WarningGroup
    W_default           = [WarningFlag]
    standardWarnings
    warningGroupFlags WarningGroup
    W_extra             = [WarningFlag]
    minusWOpts
    warningGroupFlags WarningGroup
    W_all               = [WarningFlag]
    minusWallOpts
    warningGroupFlags WarningGroup
    W_everything        = [WarningFlag]
    minusWeverythingOpts

    -- | Does this warning group contain (all) extended warning categories?  See
    -- Note [Warning categories] in GHC.Unit.Module.Warnings.
    --
    -- The 'W_extended_warnings' group contains extended warnings but no
    -- 'WarningFlag's, but extended warnings are also treated as part of 'W_default'
    -- and every warning group that includes it.
    warningGroupIncludesExtendedWarnings :: WarningGroup -> Bool
    warningGroupIncludesExtendedWarnings :: WarningGroup -> Bool
    warningGroupIncludesExtendedWarnings WarningGroup
    W_compat            = Bool
    False
    warningGroupIncludesExtendedWarnings WarningGroup
    W_unused_binds      = Bool
    False
    warningGroupIncludesExtendedWarnings WarningGroup
    W_extended_warnings = Bool
    True
    warningGroupIncludesExtendedWarnings WarningGroup
    W_default           = Bool
    True
    warningGroupIncludesExtendedWarnings WarningGroup
    W_extra             = Bool
    True
    warningGroupIncludesExtendedWarnings WarningGroup
    W_all               = Bool
    True
    warningGroupIncludesExtendedWarnings WarningGroup
    W_everything        = Bool
    True

    -- | Warning groups.
    --
    -- As all warnings are in the Weverything set, it is ignored when
    -- displaying to the user which group a warning is in.
    warningGroups :: [WarningGroup]
    warningGroups :: [WarningGroup]
    warningGroups = [WarningGroup
    forall a. Bounded a => a
    minBound..WarningGroup
    forall a. Bounded a => a
    maxBound]

    -- | Warning group hierarchies, where there is an explicit inclusion
    -- relation.
    --
    -- Each inner list is a hierarchy of warning groups, ordered from
    -- smallest to largest, where each group is a superset of the one
    -- before it.
    --
    -- Separating this from 'warningGroups' allows for multiple
    -- hierarchies with no inherent relation to be defined.
    --
    -- The special-case Weverything group is not included.
    warningHierarchies :: [[WarningGroup]]
    warningHierarchies :: [[WarningGroup]]
    warningHierarchies = [[WarningGroup]]
    hierarchies [[WarningGroup]] -> [[WarningGroup]] -> [[WarningGroup]]
    forall a. [a] -> [a] -> [a]
    ++ (WarningGroup -> [WarningGroup])
    -> [WarningGroup] -> [[WarningGroup]]
    forall a b. (a -> b) -> [a] -> [b]
    map (WarningGroup -> [WarningGroup] -> [WarningGroup]
    forall a. a -> [a] -> [a]
    :[]) [WarningGroup]
    rest
      where
        hierarchies :: [[WarningGroup]]
    hierarchies = [[WarningGroup
    W_default, WarningGroup
    W_extra, WarningGroup
    W_all]]
        rest :: [WarningGroup]
    rest = (WarningGroup -> Bool) -> [WarningGroup] -> [WarningGroup]
    forall a. (a -> Bool) -> [a] -> [a]
    filter (WarningGroup -> [WarningGroup] -> Bool
    forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
    `notElem` WarningGroup
    W_everything WarningGroup -> [WarningGroup] -> [WarningGroup]
    forall a. a -> [a] -> [a]
    : [[WarningGroup]] -> [WarningGroup]
    forall (t :: * -> *) a. Foldable t => t [a] -> [a]
    concat [[WarningGroup]]
    hierarchies) [WarningGroup]
    warningGroups

    -- | Find the smallest group in every hierarchy which a warning
    -- belongs to, excluding Weverything.
    smallestWarningGroups :: WarningFlag -> [WarningGroup]
    smallestWarningGroups :: WarningFlag -> [WarningGroup]
    smallestWarningGroups WarningFlag
    flag = ([WarningGroup] -> Maybe WarningGroup)
    -> [[WarningGroup]] -> [WarningGroup]
    forall a b. (a -> Maybe b) -> [a] -> [b]
    mapMaybe [WarningGroup] -> Maybe WarningGroup
    go [[WarningGroup]]
    warningHierarchies where
        -- Because each hierarchy is arranged from smallest to largest,
        -- the first group we find in a hierarchy which contains the flag
        -- is the smallest.
        go :: [WarningGroup] -> Maybe WarningGroup
    go (WarningGroup
    group:[WarningGroup]
    rest) = Maybe WarningGroup
    -> Maybe (Maybe WarningGroup) -> Maybe WarningGroup
    forall a. a -> Maybe a -> a
    fromMaybe ([WarningGroup] -> Maybe WarningGroup
    go [WarningGroup]
    rest) (Maybe (Maybe WarningGroup) -> Maybe WarningGroup)
    -> Maybe (Maybe WarningGroup) -> Maybe WarningGroup
    forall a b. (a -> b) -> a -> b
    $ do
            Bool -> Maybe ()
    forall (f :: * -> *). Alternative f => Bool -> f ()
    guard (WarningFlag
    flag WarningFlag -> [WarningFlag] -> Bool
    forall a. Eq a => a -> [a] -> Bool
    forall (t :: * -> *) a. (Foldable t, Eq a) => a -> t a -> Bool
    `elem` WarningGroup -> [WarningFlag]
    warningGroupFlags WarningGroup
    group)
            Maybe WarningGroup -> Maybe (Maybe WarningGroup)
    forall a. a -> Maybe a
    forall (f :: * -> *) a. Applicative f => a -> f a
    pure (WarningGroup -> Maybe WarningGroup
    forall a. a -> Maybe a
    Just WarningGroup
    group)
        go [] = Maybe WarningGroup
    forall a. Maybe a
    Nothing

    -- | The smallest group in every hierarchy to which a custom warning
    -- category belongs is currently always @-Wextended-warnings@.
    -- See Note [Warning categories] in "GHC.Unit.Module.Warnings".
    smallestWarningGroupsForCategory :: [WarningGroup]
    smallestWarningGroupsForCategory :: [WarningGroup]
    smallestWarningGroupsForCategory = [WarningGroup
    W_extended_warnings]

    -- | Warnings enabled unless specified otherwise
    standardWarnings :: [WarningFlag]
    standardWarnings :: [WarningFlag]
    standardWarnings -- see Note [Documenting warning flags]
        = [ WarningFlag
    Opt_WarnOverlappingPatterns,
            WarningFlag
    Opt_WarnDeprecatedFlags,
            WarningFlag
    Opt_WarnDeferredTypeErrors,
            WarningFlag
    Opt_WarnTypedHoles,
            WarningFlag
    Opt_WarnDeferredOutOfScopeVariables,
            WarningFlag
    Opt_WarnPartialTypeSignatures,
            WarningFlag
    Opt_WarnUnrecognisedPragmas,
            WarningFlag
    Opt_WarnMisplacedPragmas,
            WarningFlag
    Opt_WarnDuplicateExports,
            WarningFlag
    Opt_WarnDerivingDefaults,
            WarningFlag
    Opt_WarnOverflowedLiterals,
            WarningFlag
    Opt_WarnEmptyEnumerations,
            WarningFlag
    Opt_WarnAmbiguousFields,
            WarningFlag
    Opt_WarnMissingFields,
            WarningFlag
    Opt_WarnMissingMethods,
            WarningFlag
    Opt_WarnWrongDoBind,
            WarningFlag
    Opt_WarnUnsupportedCallingConventions,
            WarningFlag
    Opt_WarnDodgyForeignImports,
            WarningFlag
    Opt_WarnInlineRuleShadowing,
            WarningFlag
    Opt_WarnAlternativeLayoutRuleTransitional,
            WarningFlag
    Opt_WarnUnsupportedLlvmVersion,
            WarningFlag
    Opt_WarnMissedExtraSharedLib,
            WarningFlag
    Opt_WarnTabs,
            WarningFlag
    Opt_WarnUnrecognisedWarningFlags,
            WarningFlag
    Opt_WarnSimplifiableClassConstraints,
            WarningFlag
    Opt_WarnStarBinder,
            WarningFlag
    Opt_WarnStarIsType,
            WarningFlag
    Opt_WarnInaccessibleCode,
            WarningFlag
    Opt_WarnSpaceAfterBang,
            WarningFlag
    Opt_WarnNonCanonicalMonadInstances,
            WarningFlag
    Opt_WarnNonCanonicalMonoidInstances,
            WarningFlag
    Opt_WarnOperatorWhitespaceExtConflict,
            WarningFlag
    Opt_WarnUnicodeBidirectionalFormatCharacters,
            WarningFlag
    Opt_WarnGADTMonoLocalBinds,
            WarningFlag
    Opt_WarnBadlyStagedTypes,
            WarningFlag
    Opt_WarnTypeEqualityRequiresOperators,
            WarningFlag
    Opt_WarnInconsistentFlags,
            WarningFlag
    Opt_WarnDataKindsTC,
            WarningFlag
    Opt_WarnTypeEqualityOutOfScope,
            WarningFlag
    Opt_WarnViewPatternSignatures
          ]

    -- | Things you get with -W
    minusWOpts :: [WarningFlag]
    minusWOpts :: [WarningFlag]
    minusWOpts
        = [WarningFlag]
    standardWarnings [WarningFlag] -> [WarningFlag] -> [WarningFlag]
    forall a. [a] -> [a] -> [a]
    ++
          [ WarningFlag
    Opt_WarnUnusedTopBinds,
            WarningFlag
    Opt_WarnUnusedLocalBinds,
            WarningFlag
    Opt_WarnUnusedPatternBinds,
            WarningFlag
    Opt_WarnUnusedMatches,
            WarningFlag
    Opt_WarnUnusedForalls,
            WarningFlag
    Opt_WarnUnusedImports,
            WarningFlag
    Opt_WarnIncompletePatterns,
            WarningFlag
    Opt_WarnDodgyExports,
            WarningFlag
    Opt_WarnDodgyImports,
            WarningFlag
    Opt_WarnUnbangedStrictPatterns
          ]

    -- | Things you get with -Wall
    minusWallOpts :: [WarningFlag]
    minusWallOpts :: [WarningFlag]
    minusWallOpts
        = [WarningFlag]
    minusWOpts [WarningFlag] -> [WarningFlag] -> [WarningFlag]
    forall a. [a] -> [a] -> [a]
    ++
          [ WarningFlag
    Opt_WarnTypeDefaults,
            WarningFlag
    Opt_WarnNameShadowing,
            WarningFlag
    Opt_WarnMissingSignatures,
            WarningFlag
    Opt_WarnHiShadows,
            WarningFlag
    Opt_WarnOrphans,
            WarningFlag
    Opt_WarnUnusedDoBind,
            WarningFlag
    Opt_WarnTrustworthySafe,
            WarningFlag
    Opt_WarnMissingPatternSynonymSignatures,
            WarningFlag
    Opt_WarnUnusedRecordWildcards,
            WarningFlag
    Opt_WarnRedundantRecordWildcards,
            WarningFlag
    Opt_WarnIncompleteUniPatterns,
            WarningFlag
    Opt_WarnIncompletePatternsRecUpd,
            WarningFlag
    Opt_WarnIncompleteExportWarnings,
            WarningFlag
    Opt_WarnDerivingTypeable
          ]

    -- | Things you get with -Weverything, i.e. *all* known warnings flags
    minusWeverythingOpts :: [WarningFlag]
    minusWeverythingOpts :: [WarningFlag]
    minusWeverythingOpts = [ Int -> WarningFlag
    forall a. Enum a => Int -> a
    toEnum Int
    0 .. ]

    -- | Things you get with -Wcompat.
    --
    -- This is intended to group together warnings that will be enabled by default
    -- at some point in the future, so that library authors eager to make their
    -- code future compatible to fix issues before they even generate warnings.
    minusWcompatOpts :: [WarningFlag]
    minusWcompatOpts :: [WarningFlag]
    minusWcompatOpts
        = [ WarningFlag
    Opt_WarnImplicitRhsQuantification
          , WarningFlag
    Opt_WarnDeprecatedTypeAbstractions
          ]

    -- | Things you get with -Wunused-binds
    unusedBindsFlags :: [WarningFlag]
    unusedBindsFlags :: [WarningFlag]
    unusedBindsFlags = [ WarningFlag
    Opt_WarnUnusedTopBinds
                       , WarningFlag
    Opt_WarnUnusedLocalBinds
                       , WarningFlag
    Opt_WarnUnusedPatternBinds
                       ]