ghc-7.0.4: The GHC API

Outputable

Contents

- Type classes
- Pretty printing combinators
- Converting `SDoc` into strings and outputing it
- Controlling the style in which output is printed
- Error handling and debugging utilities

Description

This module defines classes and functions for pretty-printing. It also exports a number of helpful debugging and other utilities such as `trace` and `panic`.

The interface to this module is very similar to the standard Hughes-PJ pretty printing module, except that it exports a number of additional functions that are rarely used, and works over the `SDoc` type.

Synopsis

- class Outputable a where
  - ppr :: a -> SDoc
- class Outputable a => OutputableBndr a where
  - pprBndr :: BindingSite -> a -> SDoc
- type SDoc = PprStyle -> Doc
- docToSDoc :: Doc -> SDoc
- interppSP :: Outputable a => [a] -> SDoc
- interpp'SP :: Outputable a => [a] -> SDoc
- pprQuotedList :: Outputable a => [a] -> SDoc
- pprWithCommas :: (a -> SDoc) -> [a] -> SDoc
- quotedListWithOr :: [SDoc] -> SDoc
- empty :: SDoc
- nest :: Int -> SDoc -> SDoc
- char :: Char -> SDoc
- text :: String -> SDoc
- ftext :: FastString -> SDoc
- ptext :: LitString -> SDoc
- int :: Int -> SDoc
- integer :: Integer -> SDoc
- float :: Float -> SDoc
- double :: Double -> SDoc
- rational :: Rational -> SDoc
- parens :: SDoc -> SDoc
- cparen :: Bool -> SDoc -> SDoc
- brackets :: SDoc -> SDoc
- braces :: SDoc -> SDoc
- quotes :: SDoc -> SDoc
- doubleQuotes :: SDoc -> SDoc
- angleBrackets :: SDoc -> SDoc
- semi :: SDoc
- comma :: SDoc
- colon :: SDoc
- dcolon :: SDoc
- space :: SDoc
- equals :: SDoc
- dot :: SDoc
- arrow :: SDoc
- darrow :: SDoc
- lparen :: SDoc
- rparen :: SDoc
- lbrack :: SDoc
- rbrack :: SDoc
- lbrace :: SDoc
- rbrace :: SDoc
- underscore :: SDoc
- blankLine :: SDoc
- (<>) :: SDoc -> SDoc -> SDoc
- (<+>) :: SDoc -> SDoc -> SDoc
- hcat :: [SDoc] -> SDoc
- hsep :: [SDoc] -> SDoc
- ($$) :: SDoc -> SDoc -> SDoc
- ($+$) :: SDoc -> SDoc -> SDoc
- vcat :: [SDoc] -> SDoc
- sep :: [SDoc] -> SDoc
- cat :: [SDoc] -> SDoc
- fsep :: [SDoc] -> SDoc
- fcat :: [SDoc] -> SDoc
- hang :: SDoc -> Int -> SDoc -> SDoc
- punctuate :: SDoc -> [SDoc] -> [SDoc]
- ppWhen :: Bool -> SDoc -> SDoc
- ppUnless :: Bool -> SDoc -> SDoc
- speakNth :: Int -> SDoc
- speakNTimes :: Int -> SDoc
- speakN :: Int -> SDoc
- speakNOf :: Int -> SDoc -> SDoc
- plural :: [a] -> SDoc
- printSDoc :: SDoc -> PprStyle -> IO ()
- printErrs :: Doc -> IO ()
- printOutput :: Doc -> IO ()
- hPrintDump :: Handle -> SDoc -> IO ()
- printDump :: SDoc -> IO ()
- printForC :: Handle -> SDoc -> IO ()
- printForAsm :: Handle -> SDoc -> IO ()
- printForUser :: Handle -> PrintUnqualified -> SDoc -> IO ()
- printForUserPartWay :: Handle -> Int -> PrintUnqualified -> SDoc -> IO ()
- pprCode :: CodeStyle -> SDoc -> SDoc
- mkCodeStyle :: CodeStyle -> PprStyle
- showSDoc :: SDoc -> String
- showSDocOneLine :: SDoc -> String
- showSDocForUser :: PrintUnqualified -> SDoc -> String
- showSDocDebug :: SDoc -> String
- showSDocDump :: SDoc -> String
- showSDocDumpOneLine :: SDoc -> String
- showPpr :: Outputable a => a -> String
- showSDocUnqual :: SDoc -> String
- showsPrecSDoc :: Int -> SDoc -> ShowS
- pprInfixVar :: Bool -> SDoc -> SDoc
- pprPrefixVar :: Bool -> SDoc -> SDoc
- pprHsChar :: Char -> SDoc
- pprHsString :: FastString -> SDoc
- pprHsInfix :: Outputable name => name -> SDoc
- pprHsVar :: Outputable name => name -> SDoc
- pprFastFilePath :: FastString -> SDoc
- data BindingSite
  - = LambdaBind
  - | CaseBind
  - | LetBind
- data PprStyle
- data CodeStyle
  - = CStyle
  - | AsmStyle
- type PrintUnqualified = (QueryQualifyName, QueryQualifyModule)
- alwaysQualify :: PrintUnqualified
- neverQualify :: PrintUnqualified
- data QualifyName
  - = NameUnqual
  - | NameQual ModuleName
  - | NameNotInScope1
  - | NameNotInScope2
- getPprStyle :: (PprStyle -> SDoc) -> SDoc
- withPprStyle :: PprStyle -> SDoc -> SDoc
- withPprStyleDoc :: PprStyle -> SDoc -> Doc
- pprDeeper :: SDoc -> SDoc
- pprDeeperList :: ([SDoc] -> SDoc) -> [SDoc] -> SDoc
- pprSetDepth :: Depth -> SDoc -> SDoc
- codeStyle :: PprStyle -> Bool
- userStyle :: PprStyle -> Bool
- debugStyle :: PprStyle -> Bool
- dumpStyle :: PprStyle -> Bool
- asmStyle :: PprStyle -> Bool
- ifPprDebug :: SDoc -> SDoc
- qualName :: PprStyle -> QueryQualifyName
- qualModule :: PprStyle -> QueryQualifyModule
- mkErrStyle :: PrintUnqualified -> PprStyle
- defaultErrStyle :: PprStyle
- defaultDumpStyle :: PprStyle
- defaultUserStyle :: PprStyle
- mkUserStyle :: PrintUnqualified -> Depth -> PprStyle
- cmdlineParserStyle :: PprStyle
- data Depth
  - = AllTheWay
  - | PartWay Int
- pprPanic :: String -> SDoc -> a
- pprSorry :: String -> SDoc -> a
- assertPprPanic :: String -> Int -> SDoc -> a
- pprPanicFastInt :: String -> SDoc -> FastInt
- pprPgmError :: String -> SDoc -> a
- pprTrace :: String -> SDoc -> a -> a
- warnPprTrace :: Bool -> String -> Int -> SDoc -> a -> a
- trace :: String -> a -> a
- pgmError :: String -> a
- panic :: String -> a
- sorry :: String -> a
- panicFastInt :: String -> FastInt
- assertPanic :: String -> Int -> a

# Type classes

class Outputable a where Source

Class designating that some type has an `SDoc` representation

Methods

ppr :: a -> SDoc Source

Instances

Outputable Bool |
Outputable Char |
Outputable Int |
Outputable Word |
Outputable Word16 |
Outputable Word32 |
Outputable () |
Outputable PackageId |
Outputable ModuleName |
Outputable Module |
Outputable OccName |
Outputable FastString |
Outputable InlineSpec |
Outputable InlinePragma |
Outputable RuleMatchInfo |
Outputable Activation |
Outputable CompilerPhase |
Outputable SuccessFlag |
Outputable DefMethSpec |
Outputable StrictnessMark |
Outputable HsBang |
Outputable OccInfo |
Outputable OverlapFlag |
Outputable RecFlag |
Outputable TopLevelFlag |
Outputable FixityDirection |
Outputable Fixity |
Outputable WarningTxt |
Outputable FunctionOrData |
Outputable Unique |
Outputable RegClass |
Outputable Reg | Print a reg in a generic manner If you want the architecture specific names, then use the pprReg function from the appropriate Ppr module.
Outputable RealReg |
Outputable VirtualReg |
Outputable MetaDetails |
Outputable SrcSpan |
Outputable SrcLoc |
Outputable IdDetails |
Outputable Phase |
Outputable SlotSet |
Outputable StackPlacement |
Outputable SlotClass |
Outputable HsDocString |
Outputable Fingerprint |
Outputable TyCon |
Outputable TyThing |
Outputable PredType |
Outputable Type |
Outputable Name |
Outputable ModLocation |
Outputable CCallConv |
Outputable CCallSpec |
Outputable CExportSpec |
Outputable Safety |
Outputable ForeignCall |
Outputable Serialized |
Outputable Var |
Outputable InScopeSet |
Outputable StrictSig |
Outputable DmdResult |
Outputable DmdType |
Outputable Demands |
Outputable Demand |
Outputable StableLoc |
Outputable VolatileLoc |
Outputable CgIdInfo |
Outputable DefMeth |
Outputable Class |
Outputable ImportSpec |
Outputable Parent |
Outputable GlobalRdrElt |
Outputable RdrName |
Outputable Annotation |
Outputable DataCon |
Outputable PrimRep |
Outputable CoTyConDesc |
Outputable TvSubst |
Outputable OverLitVal |
Outputable HsLit |
Outputable CoercionI |
Outputable Literal |
Outputable PrimCall |
Outputable PrimOp |
Outputable CostCentre |
Outputable CostCentreStack |
Outputable UnfoldingGuidance |
Outputable UnfoldingSource |
Outputable Unfolding |
Outputable CoreRule |
Outputable AltCon |
Outputable TickBoxOp |
Outputable LBVarInfo |
Outputable CafInfo |
Outputable TcSpecPrag |
Outputable EvTerm |
Outputable EvBind |
Outputable EvBindsVar |
Outputable TcEvBinds |
Outputable HsWrapper |
Outputable DocDecl |
Outputable ForeignExport |
Outputable ForeignImport |
Outputable NewOrData |
Outputable IfaceTyCon |
Outputable IfacePredType |
Outputable IfaceType |
Outputable IfaceBndr |
Outputable IfaceConAlt |
Outputable IfaceNote |
Outputable IfaceExpr |
Outputable IfaceUnfolding |
Outputable IfaceInfoItem |
Outputable IfaceIdInfo |
Outputable IfaceIdDetails |
Outputable IfaceRule |
Outputable IfaceFamInst |
Outputable IfaceInst |
Outputable IfaceClassOp |
Outputable IfaceDecl |
Outputable GhcMode |
Outputable ClsInstEnv |
Outputable Instance |
Outputable FamilyInstEnv |
Outputable FamInst |
Outputable OccEncl |
Outputable ForeignLabelSource |
Outputable CLabel |
Outputable BlockSet |
Outputable BlockId |
Outputable Width |
Outputable CmmCat |
Outputable CmmType |
Outputable GlobalReg |
Outputable LocalReg |
Outputable CmmLit |
Outputable Area |
Outputable CmmReg |
Outputable CmmExpr |
Outputable CgRep |
Outputable UpdateFlag |
Outputable AltType |
Outputable C_SRT |
Outputable CmmStatic |
Outputable ForeignHint |
Outputable CmmSafety |
Outputable CmmStmt |
Outputable CmmInfo |
Outputable Instr |
Outputable Instr |
Outputable LiveInfo |
Outputable SpillStats |
Outputable Store |
Outputable Loc |
Outputable Instr |
Outputable ValueDirection |
Outputable ForeignConvention |
Outputable Convention |
Outputable Last |
Outputable Middle |
Outputable AvailRegs |
Outputable DualLive |
Outputable BreakInfo |
Outputable BCInstr |
Outputable UnlinkedBCO |
Outputable CompiledByteCode |
Outputable Protocol |
Outputable Status |
Outputable CgLoc |
Outputable CgIdInfo |
Outputable CmmTopForInfoTables |
Outputable TopSRT |
Outputable LRep |
Outputable Subst |
Outputable EtaInfo |
Outputable ArgSummary |
Outputable CallCtxt |
Outputable ExprSize |
Outputable Unlinked |
Outputable Linkable |
Outputable ModSummary |
Outputable FixItem |
Outputable Warnings |
Outputable CoreModule |
Outputable TargetId |
Outputable Target |
Outputable EqOrigin |
Outputable CtOrigin |
Outputable SkolemInfo |
Outputable CtFlavor |
Outputable Implication |
Outputable Untouchables |
Outputable WantedConstraints |
Outputable WhereFrom |
Outputable TcTyThing |
Outputable ThStage |
Outputable TcTyVarBind |
Outputable Discr |
Outputable TickInfo |
Outputable EquationInfo |
Outputable Tick |
Outputable FloatOutSwitches |
Outputable SimplifierMode |
Outputable CoreToDo |
Outputable OkToSpec |
Outputable Floats |
Outputable FloatingBind |
Outputable Level |
Outputable CallInfoSet |
Outputable CallKey |
Outputable UsageDetails |
Outputable IfaceDeclExtras |
Outputable FloatFlag |
Outputable Floats |
Outputable SimplSR |
Outputable DupFlag |
Outputable SimplCont |
Outputable AnalEnv |
Outputable ArgOcc |
Outputable HowBound |
Outputable Value |
Outputable SimplContext |
Outputable CanonicalCt |
Outputable SwapFlag |
Outputable TcSigInfo |
Outputable ClosureType |
Outputable Term |
Outputable StageResult |
Outputable StopOrContinue |
Outputable InertSet |
Outputable GeneralisationPlan |
Outputable a => Outputable [a] |
Outputable a => Outputable (Maybe a) |
Outputable name => Outputable (IPName name) |
Outputable a => Outputable (UniqFM a) |
Outputable e => Outputable (Located e) |
OutputableBndr name => Outputable (Pat name) |
Outputable a => Outputable (SCC a) |
Outputable node => Outputable (Edge node) |
Outputable node => Outputable (Graph node) |
Outputable a => Outputable (Bag a) |
OutputableBndr id => Outputable (HsSplice id) |
OutputableBndr id => Outputable (HsExpr id) |
Outputable a => Outputable (OccEnv a) |
Outputable name => Outputable (IE name) |
Outputable name => Outputable (ImportDecl name) |
Outputable name => Outputable (AnnTarget name) |
Outputable name => Outputable (HsTyVarBndr name) |
OutputableBndr name => Outputable (HsType name) |
OutputableBndr name => Outputable (HsPred name) |
OutputableBndr id => Outputable (HsQuasiQuote id) |
OutputableBndr id => Outputable (HsOverLit id) |
Outputable b => Outputable (TaggedBndr b) |
Outputable e => Outputable (DFunArg e) |
OutputableBndr b => Outputable (Bind b) |
OutputableBndr b => Outputable (Expr b) |
Outputable name => Outputable (FixitySig name) |
OutputableBndr name => Outputable (Sig name) |
OutputableBndr id => Outputable (IPBind id) |
OutputableBndr id => Outputable (HsIPBinds id) |
OutputableBndr name => Outputable (AnnDecl name) |
OutputableBndr name => Outputable (WarnDecl name) |
OutputableBndr name => Outputable (RuleBndr name) |
OutputableBndr name => Outputable (RuleDecl name) |
OutputableBndr name => Outputable (ForeignDecl name) |
OutputableBndr name => Outputable (DefaultDecl name) |
OutputableBndr name => Outputable (DerivDecl name) |
OutputableBndr name => Outputable (InstDecl name) |
OutputableBndr name => Outputable (ResType name) |
OutputableBndr name => Outputable (ConDecl name) |
OutputableBndr name => Outputable (TyClDecl name) |
OutputableBndr name => Outputable (SpliceDecl name) |
OutputableBndr name => Outputable (HsGroup name) |
OutputableBndr name => Outputable (HsDecl name) |
OutputableBndr id => Outputable (ArithSeqInfo id) |
OutputableBndr id => Outputable (HsBracket id) |
OutputableBndr id => Outputable (HsCmdTop id) |
OutputableBndr name => Outputable (HsModule name) |
Outputable a => Outputable (BlockEnv a) |
Outputable bdee => Outputable (GenStgArg bdee) |
Outputable a => Outputable (CmmHinted a) |
Outputable instr => Outputable (GenBasicBlock instr) |
Outputable instr => Outputable (ListGraph instr) |
Outputable instr => Outputable (LiveInstr instr) |
Outputable instr => Outputable (InstrSR instr) |
Outputable instr => Outputable (RegAllocStats instr) |
Outputable l => Outputable (ZLast l) |
Outputable a => Outputable (ParamLocation a) |
Outputable a => Outputable (ProtoBCO a) |
Outputable a => Outputable (NonVoid a) |
Outputable n => Outputable (GenAvailInfo n) |
Outputable (EvVarX a) |
(Outputable a, Outputable b) => Outputable (Either a b) |
(Outputable a, Outputable b) => Outputable (a, b) |
(Outputable key, Outputable elt) => Outputable (Map key elt) |
(OutputableBndr idL, OutputableBndr idR) => Outputable (HsBindLR idL idR) |
(OutputableBndr idL, OutputableBndr idR) => Outputable (HsValBindsLR idL idR) |
(OutputableBndr idL, OutputableBndr idR) => Outputable (HsLocalBindsLR idL idR) |
(OutputableBndr id, Outputable arg) => Outputable (HsRecField id arg) |
(OutputableBndr id, Outputable arg) => Outputable (HsRecFields id arg) |
(OutputableBndr idL, OutputableBndr idR) => Outputable (StmtLR idL idR) |
(Outputable bndr, Outputable bdee, Ord bdee) => Outputable (GenStgRhs bndr bdee) |
(Outputable bndr, Outputable bdee, Ord bdee) => Outputable (GenStgExpr bndr bdee) |
(Outputable bndr, Outputable bdee, Ord bdee) => Outputable (GenStgBinding bndr bdee) |
(Outputable m, Outputable l, LastNode l) => Outputable (LGraph m l) |
(Outputable m, Outputable l, LastNode l) => Outputable (Graph m l) |
(Outputable m, Outputable l, LastNode l) => Outputable (Block m l) |
(Outputable m, Outputable l) => Outputable (ZTail m l) |
(Outputable a, Outputable b, Outputable c) => Outputable (a, b, c) |
(Outputable d, Outputable info, Outputable i) => Outputable (GenCmmTop d info i) |
(Outputable d, Outputable info, Outputable g) => Outputable (GenCmm d info g) |
(Outputable a, Outputable b, Outputable c, Outputable d) => Outputable (a, b, c, d) |
(Outputable a, Outputable b, Outputable c, Outputable d, Outputable e) => Outputable (a, b, c, d, e) |

class Outputable a => OutputableBndr a where Source

When we print a binder, we often want to print its type too. The `OutputableBndr` class encapsulates this idea.

Methods

pprBndr :: BindingSite -> a -> SDoc Source

Instances

OutputableBndr Name |
OutputableBndr Var |
OutputableBndr RdrName |
Outputable name => OutputableBndr (IPName name) |
Outputable b => OutputableBndr (TaggedBndr b) |

# Pretty printing combinators

type SDoc = PprStyle -> Doc Source

docToSDoc :: Doc -> SDoc Source

interppSP :: Outputable a => [a] -> SDoc Source

Returns the seperated concatenation of the pretty printed things.

interpp'SP :: Outputable a => [a] -> SDoc Source

Returns the comma-seperated concatenation of the pretty printed things.

pprQuotedList :: Outputable a => [a] -> SDoc Source

Returns the comma-seperated concatenation of the quoted pretty printed things.

     [x,y,z]  ==>  `x', `y', `z'

pprWithCommasSource

Arguments

:: (a -> SDoc) | The pretty printing function to use
-> [a] | The things to be pretty printed
-> SDoc | `SDoc` where the things have been pretty printed, comma-separated and finally packed into a paragraph.

quotedListWithOr :: [SDoc] -> SDoc Source

empty :: SDoc Source

nest :: Int -> SDoc -> SDoc Source

Indent `SDoc` some specified amount

char :: Char -> SDoc Source

text :: String -> SDoc Source

ftext :: FastString -> SDoc Source

ptext :: LitString -> SDoc Source

int :: Int -> SDoc Source

integer :: Integer -> SDoc Source

float :: Float -> SDoc Source

double :: Double -> SDoc Source

rational :: Rational -> SDoc Source

parens :: SDoc -> SDoc Source

cparen :: Bool -> SDoc -> SDoc Source

brackets :: SDoc -> SDoc Source

braces :: SDoc -> SDoc Source

quotes :: SDoc -> SDoc Source

doubleQuotes :: SDoc -> SDoc Source

angleBrackets :: SDoc -> SDoc Source

semi :: SDoc Source

comma :: SDoc Source

colon :: SDoc Source

dcolon :: SDoc Source

space :: SDoc Source

equals :: SDoc Source

dot :: SDoc Source

arrow :: SDoc Source

darrow :: SDoc Source

lparen :: SDoc Source

rparen :: SDoc Source

lbrack :: SDoc Source

rbrack :: SDoc Source

lbrace :: SDoc Source

rbrace :: SDoc Source

underscore :: SDoc Source

blankLine :: SDoc Source

(<>) :: SDoc -> SDoc -> SDoc Source

Join two `SDoc` together horizontally without a gap

(<+>) :: SDoc -> SDoc -> SDoc Source

Join two `SDoc` together horizontally with a gap between them

hcat :: [SDoc] -> SDoc Source

Concatenate `SDoc` horizontally

hsep :: [SDoc] -> SDoc Source

Concatenate `SDoc` horizontally with a space between each one

($$) :: SDoc -> SDoc -> SDoc Source

Join two `SDoc` together vertically; if there is no vertical overlap it dovetails the two onto one line

($+$) :: SDoc -> SDoc -> SDoc Source

Join two `SDoc` together vertically

vcat :: [SDoc] -> SDoc Source

Concatenate `SDoc` vertically with dovetailing

sep :: [SDoc] -> SDoc Source

Separate: is either like `hsep` or like `vcat`, depending on what fits

cat :: [SDoc] -> SDoc Source

Catenate: is either like `hcat` or like `vcat`, depending on what fits

fsep :: [SDoc] -> SDoc Source

A paragraph-fill combinator. It's much like sep, only it keeps fitting things on one line until it can't fit any more.

fcat :: [SDoc] -> SDoc Source

This behaves like `fsep`, but it uses `<>` for horizontal conposition rather than `<+>`

hangSource

Arguments

:: SDoc | The header
-> Int | Amount to indent the hung body
-> SDoc | The hung body, indented and placed below the header
-> SDoc |

punctuateSource

Arguments

:: SDoc | The punctuation
-> [SDoc] | The list that will have punctuation added between every adjacent pair of elements
-> [SDoc] | Punctuated list

ppWhen :: Bool -> SDoc -> SDoc Source

ppUnless :: Bool -> SDoc -> SDoc Source

speakNth :: Int -> SDoc Source

Converts an integer to a verbal index:

     speakNth 1 = text "first"
     speakNth 5 = text "fifth"
     speakNth 21 = text "21st"

speakNTimes :: Int -> SDoc Source

Converts a strictly positive integer into a number of times:

     speakNTimes 1 = text "once"
     speakNTimes 2 = text "twice"
     speakNTimes 4 = text "4 times"

speakN :: Int -> SDoc Source

Converts an integer to a verbal multiplicity:

     speakN 0 = text "none"
     speakN 5 = text "five"
     speakN 10 = text "10"

speakNOf :: Int -> SDoc -> SDoc Source

Converts an integer and object description to a statement about the multiplicity of those objects:

     speakNOf 0 (text "melon") = text "no melons"
     speakNOf 1 (text "melon") = text "one melon"
     speakNOf 3 (text "melon") = text "three melons"

plural :: [a] -> SDoc Source

Determines the pluralisation suffix appropriate for the length of a list:

     plural [] = char 's'
     plural ["Hello"] = empty
     plural ["Hello", "World"] = char 's'

# Converting `SDoc` into strings and outputing it

printSDoc :: SDoc -> PprStyle -> IO ()Source

printErrs :: Doc -> IO ()Source

printOutput :: Doc -> IO ()Source

hPrintDump :: Handle -> SDoc -> IO ()Source

printDump :: SDoc -> IO ()Source

printForC :: Handle -> SDoc -> IO ()Source

printForAsm :: Handle -> SDoc -> IO ()Source

printForUser :: Handle -> PrintUnqualified -> SDoc -> IO ()Source

printForUserPartWay :: Handle -> Int -> PrintUnqualified -> SDoc -> IO ()Source

pprCode :: CodeStyle -> SDoc -> SDoc Source

mkCodeStyle :: CodeStyle -> PprStyle Source

showSDoc :: SDoc -> String Source

showSDocOneLine :: SDoc -> String Source

showSDocForUser :: PrintUnqualified -> SDoc -> String Source

showSDocDebug :: SDoc -> String Source

showSDocDump :: SDoc -> String Source

showSDocDumpOneLine :: SDoc -> String Source

showPpr :: Outputable a => a -> String Source

showSDocUnqual :: SDoc -> String Source

showsPrecSDoc :: Int -> SDoc -> ShowS Source

pprInfixVar :: Bool -> SDoc -> SDoc Source

pprPrefixVar :: Bool -> SDoc -> SDoc Source

pprHsChar :: Char -> SDoc Source

Special combinator for showing character literals.

pprHsString :: FastString -> SDoc Source

Special combinator for showing string literals.

pprHsInfix :: Outputable name => name -> SDoc Source

pprHsVar :: Outputable name => name -> SDoc Source

pprFastFilePath :: FastString -> SDoc Source

# Controlling the style in which output is printed

data BindingSite Source

`BindingSite` is used to tell the thing that prints binder what language construct is binding the identifier. This can be used to decide how much info to print.

Constructors

LambdaBind |
CaseBind |
LetBind |

data PprStyle Source

data CodeStyle Source

Constructors

CStyle |
AsmStyle |

type PrintUnqualified = (QueryQualifyName, QueryQualifyModule)Source

alwaysQualify :: PrintUnqualified Source

neverQualify :: PrintUnqualified Source

data QualifyName Source

Constructors

NameUnqual |
NameQual ModuleName |
NameNotInScope1 |
NameNotInScope2 |

getPprStyle :: (PprStyle -> SDoc) -> SDoc Source

withPprStyle :: PprStyle -> SDoc -> SDoc Source

withPprStyleDoc :: PprStyle -> SDoc -> Doc Source

pprDeeper :: SDoc -> SDoc Source

pprDeeperList :: ([SDoc] -> SDoc) -> [SDoc] -> SDoc Source

pprSetDepth :: Depth -> SDoc -> SDoc Source

codeStyle :: PprStyle -> Bool Source

userStyle :: PprStyle -> Bool Source

debugStyle :: PprStyle -> Bool Source

dumpStyle :: PprStyle -> Bool Source

asmStyle :: PprStyle -> Bool Source

ifPprDebug :: SDoc -> SDoc Source

qualName :: PprStyle -> QueryQualifyNameSource

qualModule :: PprStyle -> QueryQualifyModuleSource

mkErrStyle :: PrintUnqualified -> PprStyle Source

Style for printing error messages

defaultErrStyle :: PprStyle Source

defaultDumpStyle :: PprStyle Source

defaultUserStyle :: PprStyle Source

mkUserStyle :: PrintUnqualified -> Depth -> PprStyle Source

cmdlineParserStyle :: PprStyle Source

data Depth Source

Constructors

AllTheWay |
PartWay Int |

# Error handling and debugging utilities

pprPanic :: String -> SDoc -> aSource

Throw an exception saying bug in GHC

pprSorry :: String -> SDoc -> aSource

Throw an exceptio saying this isn't finished yet

assertPprPanic :: String -> Int -> SDoc -> aSource

Panic with an assertation failure, recording the given file and line number. Should typically be accessed with the ASSERT family of macros

pprPanicFastInt :: String -> SDoc -> FastInt Source

Specialization of pprPanic that can be safely used with `FastInt`

pprPgmError :: String -> SDoc -> aSource

Throw an exception saying bug in pgm being compiled (used for unusual program errors)

pprTrace :: String -> SDoc -> a -> aSource

If debug output is on, show some `SDoc` on the screen

warnPprTrace :: Bool -> String -> Int -> SDoc -> a -> aSource

Just warn about an assertion failure, recording the given file and line number. Should typically be accessed with the WARN macros

trace :: String -> a -> aSource

When called, `trace` outputs the string in its first argument, before returning the second argument as its result. The `trace` function is not referentially transparent, and should only be used for debugging, or for monitoring execution. Some implementations of `trace` may decorate the string that's output to indicate that you're tracing. The function is implemented on top of `putTraceMsg`.

pgmError :: String -> aSource

panic :: String -> aSource

sorry :: String -> aSource

Panics and asserts.

panicFastInt :: String -> FastInt Source

Panic while pretending to return an unboxed int. You can't use the regular panic functions in expressions producing unboxed ints because they have the wrong kind.

assertPanic :: String -> Int -> aSource

Throw an failed assertion exception for a given filename and line number.