pretty-ghci-0.2.0.0: Functionality for beautifying GHCi

Safe HaskellNone
LanguageHaskell2010

Text.PrettyPrint.GHCi

Contents

Synopsis

Interactive expression printing

prettyPrintValue :: Bool -> String -> IO () Source #

Given a Show-ed value, print that value out to the terminal, add helpful indentation and colours whenever possible. If a structured value cannot be parsed out, this falls back on print.

The Bool is to enable a slower but potentially smarter layout algorithm.

value2Doc :: String -> Doc AnsiStyle Source #

Parse a shown value into a pretty Doc. Can throw an error on outputs that could not be parsed properly, but should not throw errors for inputs which are the outputs of show from derived Show instances.

data ValuePrintConf Source #

Options for how to colour the terminal output

Constructors

ValuePrintConf 

Fields

defaultValueConf :: ValuePrintConf Source #

A Good Enough colour scheme

Interactive doc string printing

prettyPrintHaddock :: Bool -> String -> IO () Source #

Given a Haddock-formatted docstring, format and print that docstring to the terminal.

The Bool is to enable a slower but potentially smarter layout algorithm.

haddock2Doc :: String -> Doc AnsiStyle Source #

Parse a docstring into a pretty Doc. Should never throw an exception (since haddock-library will parse something out of any input).

data HaddockPrintConf Source #

Options for how to colour the terminal output

Constructors

HaddockPrintConf 

Fields

defaultHaddockConf :: HaddockPrintConf Source #

A Good Enough colour scheme

Formatting options

data AnsiStyle #

Render the annotated document in a certain style. Styles not set in the annotation will use the style of the surrounding document, or the terminal’s default if none has been set yet.

style = color Green <> bold
styledDoc = annotate style "hello world"
Instances
Eq AnsiStyle 
Instance details

Defined in Data.Text.Prettyprint.Doc.Render.Terminal.Internal

Ord AnsiStyle 
Instance details

Defined in Data.Text.Prettyprint.Doc.Render.Terminal.Internal

Show AnsiStyle 
Instance details

Defined in Data.Text.Prettyprint.Doc.Render.Terminal.Internal

Semigroup AnsiStyle

Keep the first decision for each of foreground color, background color, boldness, italication, and underlining. If a certain style is not set, the terminal’s default will be used.

Example:

color Red <> color Green

is red because the first color wins, and not bold because (or if) that’s the terminal’s default.

Instance details

Defined in Data.Text.Prettyprint.Doc.Render.Terminal.Internal

Monoid AnsiStyle

mempty does nothing, which is equivalent to inheriting the style of the surrounding doc, or the terminal’s default if no style has been set yet.

Instance details

Defined in Data.Text.Prettyprint.Doc.Render.Terminal.Internal

Color

color :: Color -> AnsiStyle #

Style the foreground with a vivid color.

colorDull :: Color -> AnsiStyle #

Style the foreground with a dull color.

bgColor :: Color -> AnsiStyle #

Style the background with a vivid color.

bgColorDull :: Color -> AnsiStyle #

Style the background with a dull color.

data Color #

The 8 ANSI terminal colors.

Constructors

Black 
Red 
Green 
Yellow 
Blue 
Magenta 
Cyan 
White 
Instances
Eq Color 
Instance details

Defined in Data.Text.Prettyprint.Doc.Render.Terminal.Internal

Methods

(==) :: Color -> Color -> Bool #

(/=) :: Color -> Color -> Bool #

Ord Color 
Instance details

Defined in Data.Text.Prettyprint.Doc.Render.Terminal.Internal

Methods

compare :: Color -> Color -> Ordering #

(<) :: Color -> Color -> Bool #

(<=) :: Color -> Color -> Bool #

(>) :: Color -> Color -> Bool #

(>=) :: Color -> Color -> Bool #

max :: Color -> Color -> Color #

min :: Color -> Color -> Color #

Show Color 
Instance details

Defined in Data.Text.Prettyprint.Doc.Render.Terminal.Internal

Methods

showsPrec :: Int -> Color -> ShowS #

show :: Color -> String #

showList :: [Color] -> ShowS #

Style

bold :: AnsiStyle #

Render in bold.

italicized :: AnsiStyle #

Render in italics.

underlined :: AnsiStyle #

Render underlined.