ghc-lib-parser-9.12.2.20250421: The GHC API, decoupled from GHC versions

Safe Haskell | Ignore
Language | GHC2021

GHC.Unit.Module.Warnings

Description

Warnings for a module

Synopsis

- newtype WarningCategory = WarningCategory FastString
- mkWarningCategory :: FastString -> WarningCategory
- defaultWarningCategory :: WarningCategory
- validWarningCategory :: WarningCategory -> Bool
- data InWarningCategory = InWarningCategory {
  - iwc_in :: !(EpToken "in")
  - iwc_st :: !SourceText
  - iwc_wc :: LocatedE WarningCategory
  }
- fromWarningCategory :: WarningCategory -> InWarningCategory
- data WarningCategorySet
- emptyWarningCategorySet :: WarningCategorySet
- completeWarningCategorySet :: WarningCategorySet
- nullWarningCategorySet :: WarningCategorySet -> Bool
- elemWarningCategorySet :: WarningCategory -> WarningCategorySet -> Bool
- insertWarningCategorySet :: WarningCategory -> WarningCategorySet -> WarningCategorySet
- deleteWarningCategorySet :: WarningCategory -> WarningCategorySet -> WarningCategorySet
- data Warnings pass
  - = WarnSome (DeclWarnOccNames pass) (ExportWarnNames pass)
  - | WarnAll (WarningTxt pass)
- data WarningTxt pass
  - = WarningTxt (Maybe (LocatedE InWarningCategory)) SourceText [LocatedE (WithHsDocIdentifiers StringLiteral pass)]
  - | DeprecatedTxt SourceText [LocatedE (WithHsDocIdentifiers StringLiteral pass)]
- type LWarningTxt pass = XRec pass (WarningTxt pass)
- type DeclWarnOccNames pass = [(OccName, WarningTxt pass)]
- type ExportWarnNames pass = [(Name, WarningTxt pass)]
- warningTxtCategory :: WarningTxt pass -> WarningCategory
- warningTxtMessage :: WarningTxt p -> [LocatedE (WithHsDocIdentifiers StringLiteral p)]
- warningTxtSame :: WarningTxt p1 -> WarningTxt p2 -> Bool
- pprWarningTxtForMsg :: WarningTxt p -> SDoc
- emptyWarn :: Warnings p
- mkIfaceDeclWarnCache :: Warnings p -> OccName -> Maybe (WarningTxt p)
- mkIfaceExportWarnCache :: Warnings p -> Name -> Maybe (WarningTxt p)
- emptyIfaceWarnCache :: name -> Maybe (WarningTxt p)
- insertWarnDecls :: Warnings p -> [(OccName, WarningTxt p)] -> Warnings p
- insertWarnExports :: Warnings p -> [(Name, WarningTxt p)] -> Warnings p

# Documentation

newtype WarningCategory Source #

Constructors

WarningCategory FastString |

#### Instances

Instances details

NFData WarningCategory Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods rnf :: WarningCategory -> () Source #
Data WarningCategory Source # |

Instance details

Defined in GHC.Unit.Module.Warnings

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WarningCategory -> c WarningCategory Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c WarningCategory Source #

toConstr :: WarningCategory -> Constr Source #

dataTypeOf :: WarningCategory -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c WarningCategory) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c WarningCategory) Source #

gmapT :: (forall b. Data b => b -> b) -> WarningCategory -> WarningCategory Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WarningCategory -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WarningCategory -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> WarningCategory -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> WarningCategory -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> WarningCategory -> m WarningCategory Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WarningCategory -> m WarningCategory Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WarningCategory -> m WarningCategory Source #

Show WarningCategory Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods showsPrec :: Int -> WarningCategory -> ShowS Source # show :: WarningCategory -> String Source # showList :: [WarningCategory] -> ShowS Source #
Uniquable WarningCategory Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods getUnique :: WarningCategory -> Unique Source #
Binary WarningCategory Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods put_ :: WriteBinHandle -> WarningCategory -> IO () Source # put :: WriteBinHandle -> WarningCategory -> IO (Bin WarningCategory) Source # get :: ReadBinHandle -> IO WarningCategory Source #
Outputable WarningCategory Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods ppr :: WarningCategory -> SDoc Source #
Eq WarningCategory Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods (==) :: WarningCategory -> WarningCategory -> Bool Source # (/=) :: WarningCategory -> WarningCategory -> Bool Source #

mkWarningCategory :: FastString -> WarningCategory Source #

defaultWarningCategory :: WarningCategory Source #

The `deprecations` category is used for all DEPRECATED pragmas and for WARNING pragmas that do not specify a category.

validWarningCategory :: WarningCategory -> Bool Source #

Is this warning category allowed to appear in user-defined WARNING pragmas? It must either be the known category `deprecations`, or be a custom category that begins with `x-` and contains only valid characters (letters, numbers, apostrophes and dashes).

data InWarningCategory Source #

Constructors

InWarningCategory |

Fields

- iwc_in :: !(EpToken "in")
- iwc_st :: !SourceText
- iwc_wc :: LocatedE WarningCategory

#### Instances

Instances details

Data InWarningCategory Source # |

Instance details

Defined in GHC.Unit.Module.Warnings

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> InWarningCategory -> c InWarningCategory Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c InWarningCategory Source #

toConstr :: InWarningCategory -> Constr Source #

dataTypeOf :: InWarningCategory -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c InWarningCategory) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c InWarningCategory) Source #

gmapT :: (forall b. Data b => b -> b) -> InWarningCategory -> InWarningCategory Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> InWarningCategory -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> InWarningCategory -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> InWarningCategory -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> InWarningCategory -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> InWarningCategory -> m InWarningCategory Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> InWarningCategory -> m InWarningCategory Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> InWarningCategory -> m InWarningCategory Source #

Outputable InWarningCategory Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods ppr :: InWarningCategory -> SDoc Source #
Eq InWarningCategory Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods (==) :: InWarningCategory -> InWarningCategory -> Bool Source # (/=) :: InWarningCategory -> InWarningCategory -> Bool Source #

fromWarningCategory :: WarningCategory -> InWarningCategory Source #

data WarningCategorySet Source #

A finite or infinite set of warning categories.

Unlike `WarningFlag`, there are (in principle) infinitely many warning categories, so we cannot necessarily enumerate all of them. However the set is constructed by adding or removing categories one at a time, so we can represent it as either a finite set of categories, or a cofinite set (where we store the complement).

emptyWarningCategorySet :: WarningCategorySet Source #

The empty set of warning categories.

completeWarningCategorySet :: WarningCategorySet Source #

The set consisting of all possible warning categories.

nullWarningCategorySet :: WarningCategorySet -> Bool Source #

Is this set empty?

elemWarningCategorySet :: WarningCategory -> WarningCategorySet -> Bool Source #

Does this warning category belong to the set?

insertWarningCategorySet :: WarningCategory -> WarningCategorySet -> WarningCategorySet Source #

Insert an element into a warning category set.

deleteWarningCategorySet :: WarningCategory -> WarningCategorySet -> WarningCategorySet Source #

Delete an element from a warning category set.

data Warnings pass Source #

Warning information from a module

Constructors

WarnSome |

Fields

- (DeclWarnOccNames pass)

  Names deprecated (may be empty)

- (ExportWarnNames pass)

  Exports deprecated (may be empty)

WarnAll (WarningTxt pass) | Whole module deprecated

#### Instances

Instances details

Eq (IdP pass) => Eq (Warnings pass) Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods (==) :: Warnings pass -> Warnings pass -> Bool Source # (/=) :: Warnings pass -> Warnings pass -> Bool Source #

data WarningTxt pass Source #

Warning Text

reason/explanation from a WARNING or DEPRECATED pragma

Constructors

WarningTxt |

Fields

- (Maybe (LocatedE InWarningCategory))

  Warning category attached to this WARNING pragma, if any; see Note [Warning categories]

- SourceText
- [LocatedE (WithHsDocIdentifiers StringLiteral pass)]

DeprecatedTxt SourceText [LocatedE (WithHsDocIdentifiers StringLiteral pass)] |

#### Instances

Instances details

(Data pass, Data (IdP pass)) => Data (WarningTxt pass) Source # |

Instance details

Defined in GHC.Unit.Module.Warnings

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> WarningTxt pass -> c (WarningTxt pass) Source #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c (WarningTxt pass) Source #

toConstr :: WarningTxt pass -> Constr Source #

dataTypeOf :: WarningTxt pass -> DataType Source #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c (WarningTxt pass)) Source #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c (WarningTxt pass)) Source #

gmapT :: (forall b. Data b => b -> b) -> WarningTxt pass -> WarningTxt pass Source #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> WarningTxt pass -> r Source #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> WarningTxt pass -> r Source #

gmapQ :: (forall d. Data d => d -> u) -> WarningTxt pass -> [u] Source #

gmapQi :: Int -> (forall d. Data d => d -> u) -> WarningTxt pass -> u Source #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> WarningTxt pass -> m (WarningTxt pass) Source #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> WarningTxt pass -> m (WarningTxt pass) Source #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> WarningTxt pass -> m (WarningTxt pass) Source #

Generic (WarningTxt pass) Source # |

Instance details

Defined in GHC.Unit.Module.Warnings

Associated Types

type Rep (WarningTxt pass) |

Instance details

Defined in GHC.Unit.Module.Warnings

type Rep (WarningTxt pass) = D1 ('MetaData "WarningTxt" "GHC.Unit.Module.Warnings" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" 'False) (C1 ('MetaCons "WarningTxt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (LocatedE InWarningCategory))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceText) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [LocatedE (WithHsDocIdentifiers StringLiteral pass)]))) :+: C1 ('MetaCons "DeprecatedTxt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceText) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [LocatedE (WithHsDocIdentifiers StringLiteral pass)])))

Methods

from :: WarningTxt pass -> Rep (WarningTxt pass) x Source #

to :: Rep (WarningTxt pass) x -> WarningTxt pass Source #

Outputable (WarningTxt pass) Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods ppr :: WarningTxt pass -> SDoc Source #
Eq (IdP pass) => Eq (WarningTxt pass) Source # |
Instance details Defined in GHC.Unit.Module.Warnings Methods (==) :: WarningTxt pass -> WarningTxt pass -> Bool Source # (/=) :: WarningTxt pass -> WarningTxt pass -> Bool Source #
type Rep (WarningTxt pass) Source # |

Instance details

Defined in GHC.Unit.Module.Warnings

type Rep (WarningTxt pass) = D1 ('MetaData "WarningTxt" "GHC.Unit.Module.Warnings" "ghc-lib-parser-9.12.2.20250421-CLarrBnVGcX5rqdmHKZO6f" 'False) (C1 ('MetaCons "WarningTxt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Maybe (LocatedE InWarningCategory))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceText) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [LocatedE (WithHsDocIdentifiers StringLiteral pass)]))) :+: C1 ('MetaCons "DeprecatedTxt" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SourceText) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [LocatedE (WithHsDocIdentifiers StringLiteral pass)])))

type Anno (WarningTxt (GhcPass pass)) Source # |
Instance details Defined in GHC.Unit.Module.Warnings type Anno (WarningTxt (GhcPass pass)) = SrcSpanAnnP

type LWarningTxt pass = XRec pass (WarningTxt pass) Source #

type DeclWarnOccNames pass = [(OccName, WarningTxt pass)] Source #

Deprecated declarations

type ExportWarnNames pass = [(Name, WarningTxt pass)] Source #

Names that are deprecated as exports

warningTxtCategory :: WarningTxt pass -> WarningCategory Source #

To which warning category does this WARNING or DEPRECATED pragma belong? See Note [Warning categories].

warningTxtMessage :: WarningTxt p -> [LocatedE (WithHsDocIdentifiers StringLiteral p)] Source #

The message that the WarningTxt was specified to output

warningTxtSame :: WarningTxt p1 -> WarningTxt p2 -> Bool Source #

True if the 2 WarningTxts have the same category and messages

pprWarningTxtForMsg :: WarningTxt p -> SDoc Source #

emptyWarn :: Warnings p Source #

mkIfaceDeclWarnCache :: Warnings p -> OccName -> Maybe (WarningTxt p) Source #

Constructs the cache for the `mi_decl_warn_fn` field of a `ModIface`

mkIfaceExportWarnCache :: Warnings p -> Name -> Maybe (WarningTxt p) Source #

Constructs the cache for the `mi_export_warn_fn` field of a `ModIface`

emptyIfaceWarnCache :: name -> Maybe (WarningTxt p) Source #

insertWarnDecls Source #

Arguments

:: Warnings p | Existing warnings
-> [(OccName, WarningTxt p)] | New declaration deprecations
-> Warnings p | Updated warnings

insertWarnExports Source #

Arguments

:: Warnings p | Existing warnings
-> [(Name, WarningTxt p)] | New export deprecations
-> Warnings p | Updated warnings