Language.Haskell.TH.Ppr

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

Safe Haskell | Ignore
Language | GHC2021

Language.Haskell.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
- pprCxt :: Cxt -> 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 #

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 #

Minimal complete definition

ppr

Methods

ppr :: a -> Doc #

ppr_list :: [a] -> Doc #

#### Instances

Instances details

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

ppr_sig :: Name -> Type -> Doc #

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

pprNamespaceSpecifier :: NamespaceSpecifier -> Doc #

pprPatSynSig :: Name -> PatSynType -> Doc #

Pretty prints a pattern synonym type signature

pprPatSynType :: PatSynType -> Doc #

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 #

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 #

Arguments

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

ppr_deriv_strategy :: DerivStrategy -> Doc #

ppr_overlap :: Overlap -> Doc #

ppr_data #

Arguments

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

ppr_newtype #

Arguments

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

ppr_type_data #

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 #

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 #

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

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

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

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 #

Constructors

ForallVis |
ForallInvis |

#### Instances

Instances details

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

data TypeArg #

Constructors

TANormal Type |
TyArg Kind |

#### Instances

Instances details

Ppr TypeArg # |
Instance details Defined in Language.Haskell.TH.Ppr Methods ppr :: TypeArg -> Doc # ppr_list :: [TypeArg] -> Doc #

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

pprTyLit :: TyLit -> Doc #

class PprFlag flag where #

Methods

pprTyVarBndr :: TyVarBndr flag -> Doc #

#### Instances

Instances details

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

pprBndrVis :: BndrVis -> Doc -> Doc #

pprCxt :: Cxt -> 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 #