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

Safe Haskell | Ignore
Language | GHC2021

GHC.Internal.TH.Ppr

Description

contains a prettyprinter for the Template Haskell datatypes

Synopsis

- nestDepth :: Int
- type Precedence = Int
- appPrec :: Precedence
- opPrec :: Precedence
- unopPrec :: Precedence
- funPrec :: Precedence
- qualPrec :: Precedence
- sigPrec :: Precedence
- noPrec :: Precedence
- parensIf :: Bool -> Doc -> Doc
- pprint :: Ppr a => a -> String
- class Ppr a where
  - ppr :: a -> Doc
  - ppr_list :: [a] -> Doc
- ppr_sig :: Name -> Type -> Doc
- pprFixity :: Name -> Fixity -> NamespaceSpecifier -> Doc
- pprNamespaceSpecifier :: NamespaceSpecifier -> Doc
- pprPatSynSig :: Name -> PatSynType -> Doc
- pprPatSynType :: PatSynType -> Doc
- pprPrefixOcc :: Name -> Doc
- isSymOcc :: Name -> Bool
- pprInfixExp :: Exp -> Doc
- pprExp :: Precedence -> Exp -> Doc
- pprFields :: [(Name, Exp)] -> Doc
- pprMaybeExp :: Precedence -> Maybe Exp -> Doc
- pprMatchPat :: Pat -> Doc
- pprGuarded :: Doc -> (Guard, Exp) -> Doc
- pprBody :: Bool -> Body -> Doc
- pprClause :: Bool -> Clause -> Doc
- pprLit :: Precedence -> Lit -> Doc
- bytesToString :: [Word8] -> String
- pprString :: String -> Doc
- pprPat :: Precedence -> Pat -> Doc
- ppr_dec :: Bool -> Dec -> Doc
- ppr_deriv_strategy :: DerivStrategy -> Doc
- ppr_overlap :: Overlap -> Doc
- ppr_data :: Bool -> Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> [Con] -> [DerivClause] -> Doc
- ppr_newtype :: Bool -> Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> Con -> [DerivClause] -> Doc
- ppr_type_data :: Bool -> Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> [Con] -> [DerivClause] -> Doc
- ppr_typedef :: String -> Bool -> Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> [Con] -> [DerivClause] -> Doc
- ppr_deriv_clause :: DerivClause -> Doc
- ppr_tySyn :: Doc -> Maybe Name -> Doc -> Type -> Doc
- ppr_tf_head :: TypeFamilyHead -> Doc
- ppr_bndrs :: PprFlag flag => Maybe [TyVarBndr flag] -> Doc
- commaSepApplied :: [Name] -> Doc
- pprForall :: [TyVarBndr Specificity] -> Cxt -> Doc
- pprForallVis :: [TyVarBndr ()] -> Cxt -> Doc
- pprForall' :: PprFlag flag => ForallVisFlag -> [TyVarBndr flag] -> Cxt -> Doc
- pprRecFields :: [(Name, Strict, Type)] -> Type -> Doc
- pprGadtRHS :: [(Strict, Type)] -> Type -> Doc
- pprVarBangType :: VarBangType -> Doc
- pprBangType :: BangType -> Doc
- pprVarStrictType :: (Name, Strict, Type) -> Doc
- pprStrictType :: (Strict, Type) -> Doc
- pprType :: Precedence -> Type -> Doc
- pprParendType :: Type -> Doc
- pprInfixT :: Precedence -> Type -> Doc
- pprParendTypeArg :: TypeArg -> Doc
- isStarT :: Type -> Bool
- pprTyApp :: Precedence -> (Type, [TypeArg]) -> Doc
- fromTANormal :: TypeArg -> Maybe Type
- pprFunArgType :: Type -> Doc
- data ForallVisFlag
  - = ForallVis
  - | ForallInvis
- data TypeArg
  - = TANormal Type
  - | TyArg Kind
- split :: Type -> (Type, [TypeArg])
- pprTyLit :: TyLit -> Doc
- class PprFlag flag where
  - pprTyVarBndr :: TyVarBndr flag -> Doc
- pprBndrVis :: BndrVis -> Doc -> Doc
- pprCtxWith :: Ppr a => (Precedence -> a -> Doc) -> [a] -> Doc
- pprCxt :: Cxt -> Doc
- ppr_ctx_preds_with :: Ppr a => (Precedence -> a -> Doc) -> Precedence -> [a] -> Doc
- ppr_cxt_preds :: Precedence -> Cxt -> Doc
- where_clause :: [Dec] -> Doc
- showtextl :: Show a => a -> Doc
- hashParens :: Doc -> Doc
- quoteParens :: Doc -> Doc
- sepWith :: Doc -> (a -> Doc) -> [a] -> Doc
- commaSep :: Ppr a => [a] -> Doc
- commaSepWith :: (a -> Doc) -> [a] -> Doc
- semiSep :: Ppr a => [a] -> Doc
- semiSepWith :: (a -> Doc) -> [a] -> Doc
- unboxedSumBars :: Doc -> SumAlt -> SumArity -> Doc
- bar :: Doc

# Documentation

nestDepth :: Int Source #

type Precedence = Int Source #

appPrec :: Precedence Source #

opPrec :: Precedence Source #

unopPrec :: Precedence Source #

funPrec :: Precedence Source #

qualPrec :: Precedence Source #

sigPrec :: Precedence Source #

noPrec :: Precedence Source #

parensIf :: Bool -> Doc -> Doc Source #

pprint :: Ppr a => a -> String Source #

class Ppr a where Source #

Minimal complete definition

ppr

Methods

ppr :: a -> Doc Source #

ppr_list :: [a] -> Doc Source #

#### Instances

Instances details

Ppr TypeArg Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: TypeArg -> Doc Source # ppr_list :: [TypeArg] -> Doc Source #
Ppr Bang Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Bang -> Doc Source # ppr_list :: [Bang] -> Doc Source #
Ppr Clause Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Clause -> Doc Source # ppr_list :: [Clause] -> Doc Source #
Ppr Con Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Con -> Doc Source # ppr_list :: [Con] -> Doc Source #
Ppr Dec Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Dec -> Doc Source # ppr_list :: [Dec] -> Doc Source #
Ppr DecidedStrictness Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: DecidedStrictness -> Doc Source # ppr_list :: [DecidedStrictness] -> Doc Source #
Ppr Exp Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Exp -> Doc Source # ppr_list :: [Exp] -> Doc Source #
Ppr FamilyResultSig Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: FamilyResultSig -> Doc Source # ppr_list :: [FamilyResultSig] -> Doc Source #
Ppr Foreign Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Foreign -> Doc Source # ppr_list :: [Foreign] -> Doc Source #
Ppr FunDep Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: FunDep -> Doc Source # ppr_list :: [FunDep] -> Doc Source #
Ppr Info Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Info -> Doc Source # ppr_list :: [Info] -> Doc Source #
Ppr InjectivityAnn Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: InjectivityAnn -> Doc Source # ppr_list :: [InjectivityAnn] -> Doc Source #
Ppr Inline Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Inline -> Doc Source # ppr_list :: [Inline] -> Doc Source #
Ppr Lit Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Lit -> Doc Source # ppr_list :: [Lit] -> Doc Source #
Ppr Loc Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Loc -> Doc Source # ppr_list :: [Loc] -> Doc Source #
Ppr Match Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Match -> Doc Source # ppr_list :: [Match] -> Doc Source #
Ppr Module Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Module -> Doc Source # ppr_list :: [Module] -> Doc Source #
Ppr ModuleInfo Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: ModuleInfo -> Doc Source # ppr_list :: [ModuleInfo] -> Doc Source #
Ppr Name Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Name -> Doc Source # ppr_list :: [Name] -> Doc Source #
Ppr Pat Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Pat -> Doc Source # ppr_list :: [Pat] -> Doc Source #
Ppr PatSynArgs Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: PatSynArgs -> Doc Source # ppr_list :: [PatSynArgs] -> Doc Source #
Ppr PatSynDir Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: PatSynDir -> Doc Source # ppr_list :: [PatSynDir] -> Doc Source #
Ppr Phases Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Phases -> Doc Source # ppr_list :: [Phases] -> Doc Source #
Ppr Pragma Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Pragma -> Doc Source # ppr_list :: [Pragma] -> Doc Source #
Ppr Range Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Range -> Doc Source # ppr_list :: [Range] -> Doc Source #
Ppr Role Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Role -> Doc Source # ppr_list :: [Role] -> Doc Source #
Ppr RuleBndr Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: RuleBndr -> Doc Source # ppr_list :: [RuleBndr] -> Doc Source #
Ppr RuleMatch Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: RuleMatch -> Doc Source # ppr_list :: [RuleMatch] -> Doc Source #
Ppr SourceStrictness Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: SourceStrictness -> Doc Source # ppr_list :: [SourceStrictness] -> Doc Source #
Ppr SourceUnpackedness Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: SourceUnpackedness -> Doc Source # ppr_list :: [SourceUnpackedness] -> Doc Source #
Ppr Stmt Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Stmt -> Doc Source # ppr_list :: [Stmt] -> Doc Source #
Ppr TyLit Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: TyLit -> Doc Source # ppr_list :: [TyLit] -> Doc Source #
Ppr Type Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: Type -> Doc Source # ppr_list :: [Type] -> Doc Source #
PprFlag flag => Ppr (TyVarBndr flag) Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: TyVarBndr flag -> Doc Source # ppr_list :: [TyVarBndr flag] -> Doc Source #
Ppr a => Ppr [a] Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: [a] -> Doc Source # ppr_list :: [[a]] -> Doc Source #

ppr_sig :: Name -> Type -> Doc Source #

pprFixity :: Name -> Fixity -> NamespaceSpecifier -> Doc Source #

pprNamespaceSpecifier :: NamespaceSpecifier -> Doc Source #

pprPatSynSig :: Name -> PatSynType -> Doc Source #

Pretty prints a pattern synonym type signature

pprPatSynType :: PatSynType -> Doc Source #

Pretty prints a pattern synonym's type; follows the usual conventions to print a pattern synonym type compactly, yet unambiguously. See the note on `PatSynType` and the section on pattern synonyms in the GHC user's guide for more information.

pprPrefixOcc :: Name -> Doc Source #

isSymOcc :: Name -> Bool Source #

pprInfixExp :: Exp -> Doc Source #

pprExp :: Precedence -> Exp -> Doc Source #

pprFields :: [(Name, Exp)] -> Doc Source #

pprMaybeExp :: Precedence -> Maybe Exp -> Doc Source #

pprMatchPat :: Pat -> Doc Source #

pprGuarded :: Doc -> (Guard, Exp) -> Doc Source #

pprBody :: Bool -> Body -> Doc Source #

pprClause :: Bool -> Clause -> Doc Source #

pprLit :: Precedence -> Lit -> Doc Source #

bytesToString :: [Word8] -> String Source #

pprString :: String -> Doc Source #

pprPat :: Precedence -> Pat -> Doc Source #

ppr_dec Source #

Arguments

:: Bool | declaration on the toplevel?
-> Dec |
-> Doc |

ppr_deriv_strategy :: DerivStrategy -> Doc Source #

ppr_overlap :: Overlap -> Doc Source #

ppr_data Source #

Arguments

:: Bool | declaration on the toplevel?
-> Doc |
-> Cxt |
-> Maybe Name |
-> Doc |
-> Maybe Kind |
-> [Con] |
-> [DerivClause] |
-> Doc |

ppr_newtype Source #

Arguments

:: Bool | declaration on the toplevel?
-> Doc |
-> Cxt |
-> Maybe Name |
-> Doc |
-> Maybe Kind |
-> Con |
-> [DerivClause] |
-> Doc |

ppr_type_data Source #

Arguments

:: Bool | declaration on the toplevel?
-> Doc |
-> Cxt |
-> Maybe Name |
-> Doc |
-> Maybe Kind |
-> [Con] |
-> [DerivClause] |
-> Doc |

ppr_typedef :: String -> Bool -> Doc -> Cxt -> Maybe Name -> Doc -> Maybe Kind -> [Con] -> [DerivClause] -> Doc Source #

ppr_deriv_clause :: DerivClause -> Doc Source #

ppr_tySyn :: Doc -> Maybe Name -> Doc -> Type -> Doc Source #

ppr_tf_head :: TypeFamilyHead -> Doc Source #

ppr_bndrs :: PprFlag flag => Maybe [TyVarBndr flag] -> Doc Source #

commaSepApplied :: [Name] -> Doc Source #

pprForall :: [TyVarBndr Specificity] -> Cxt -> Doc Source #

pprForallVis :: [TyVarBndr ()] -> Cxt -> Doc Source #

pprForall' :: PprFlag flag => ForallVisFlag -> [TyVarBndr flag] -> Cxt -> Doc Source #

pprRecFields :: [(Name, Strict, Type)] -> Type -> Doc Source #

pprGadtRHS :: [(Strict, Type)] -> Type -> Doc Source #

pprVarBangType :: VarBangType -> Doc Source #

pprBangType :: BangType -> Doc Source #

pprVarStrictType :: (Name, Strict, Type) -> Doc Source #

Deprecated: As of `template-haskell-2.11.0.0`, `VarStrictType` has been replaced by `VarBangType`. Please use `pprVarBangType` instead.

pprStrictType :: (Strict, Type) -> Doc Source #

Deprecated: As of `template-haskell-2.11.0.0`, `StrictType` has been replaced by `BangType`. Please use `pprBangType` instead.

pprType :: Precedence -> Type -> Doc Source #

pprParendType :: Type -> Doc Source #

pprInfixT :: Precedence -> Type -> Doc Source #

pprParendTypeArg :: TypeArg -> Doc Source #

isStarT :: Type -> Bool Source #

pprTyApp :: Precedence -> (Type, [TypeArg]) -> Doc Source #

fromTANormal :: TypeArg -> Maybe Type Source #

pprFunArgType :: Type -> Doc Source #

data ForallVisFlag Source #

Constructors

ForallVis |
ForallInvis |

#### Instances

Instances details

Show ForallVisFlag Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods showsPrec :: Int -> ForallVisFlag -> ShowS Source # show :: ForallVisFlag -> String Source # showList :: [ForallVisFlag] -> ShowS Source #

data TypeArg Source #

Constructors

TANormal Type |
TyArg Kind |

#### Instances

Instances details

Ppr TypeArg Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods ppr :: TypeArg -> Doc Source # ppr_list :: [TypeArg] -> Doc Source #

split :: Type -> (Type, [TypeArg]) Source #

pprTyLit :: TyLit -> Doc Source #

class PprFlag flag where Source #

Methods

pprTyVarBndr :: TyVarBndr flag -> Doc Source #

#### Instances

Instances details

PprFlag BndrVis Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods pprTyVarBndr :: TyVarBndr BndrVis -> Doc Source #
PprFlag Specificity Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods pprTyVarBndr :: TyVarBndr Specificity -> Doc Source #
PprFlag () Source # |
Instance details Defined in GHC.Internal.TH.Ppr Methods pprTyVarBndr :: TyVarBndr () -> Doc Source #

pprBndrVis :: BndrVis -> Doc -> Doc Source #

pprCtxWith :: Ppr a => (Precedence -> a -> Doc) -> [a] -> Doc Source #

pprCxt :: Cxt -> Doc Source #

ppr_ctx_preds_with :: Ppr a => (Precedence -> a -> Doc) -> Precedence -> [a] -> Doc Source #

ppr_cxt_preds :: Precedence -> Cxt -> Doc Source #

where_clause :: [Dec] -> Doc Source #

showtextl :: Show a => a -> Doc Source #

hashParens :: Doc -> Doc Source #

quoteParens :: Doc -> Doc Source #

sepWith :: Doc -> (a -> Doc) -> [a] -> Doc Source #

commaSep :: Ppr a => [a] -> Doc Source #

commaSepWith :: (a -> Doc) -> [a] -> Doc Source #

semiSep :: Ppr a => [a] -> Doc Source #

semiSepWith :: (a -> Doc) -> [a] -> Doc Source #

unboxedSumBars :: Doc -> SumAlt -> SumArity -> Doc Source #

bar :: Doc Source #