rio-prettyprint-0.1.4.0: Pretty-printing for RIO
Safe HaskellSafe-Inferred
LanguageHaskell2010

RIO.PrettyPrint

Synopsis

Type classes for optionally colored terminal output

class HasStylesUpdate env where Source #

Environment values with a styles update.

Since: 0.1.0.0

Pretty printing functions

Logging based on pretty-print typeclass

Semantic styling functions

These are used rather than applying colors or other styling directly, to provide consistency.

style :: Style -> StyleDoc -> StyleDoc Source #

Annotate a StyleDoc with a Style.

logLevelToStyle :: LogLevel -> Style Source #

The Style intended to be associated with a LogLevel.

Since: 0.1.1.0

Formatting utils

bulletedList :: [StyleDoc] -> StyleDoc Source #

Display a bulleted list of StyleDoc.

mkNarrativeList Source #

Arguments

:: Pretty a 
=> Maybe Style

Style the items in the list?

-> Bool

Use a serial comma?

-> [a] 
-> [StyleDoc] 

A helper function to yield a narrative list from a list of items, with a final fullstop. For example, helps produce the output "apple, ball and cat." (no serial comma) or "apple, ball, and cat." (serial comma) from ["apple", "ball", "cat"].

Since: 0.1.4.0

spacedBulletedList :: [StyleDoc] -> StyleDoc Source #

Display a bulleted list of StyleDoc with a blank line between each.

Re-exports from Text.PrettyPrint.Leijen.Extended

class Pretty a where Source #

Minimal complete definition

Nothing

Methods

pretty :: a -> StyleDoc Source #

default pretty :: Show a => a -> StyleDoc Source #

Instances

Instances details
Pretty ModuleName Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Pretty PrettyException Source # 
Instance details

Defined in RIO.PrettyPrint.PrettyException

Pretty StyleDoc Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Pretty (Path b Dir) Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

pretty :: Path b Dir -> StyleDoc Source #

Pretty (Path b File) Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

pretty :: Path b File -> StyleDoc Source #

data StyleDoc Source #

A document annotated by a style

newtype StyleAnn Source #

A style annotation.

Constructors

StyleAnn (Maybe Style) 

string :: String -> StyleDoc Source #

The document string s concatenates all characters in s using line for newline characters and char for all other characters. It is used whenever the text contains newline characters.

Since: 0.1.4.0

indentAfterLabel :: StyleDoc -> StyleDoc Source #

Use after a label and before the rest of what's being labelled for consistent spacingindentingetc.

For example this is used after "Warning:" in warning messages.

wordDocs :: String -> [StyleDoc] Source #

Make a Doc from each word in a String

flow :: String -> StyleDoc Source #

Wordwrap a String

Re-exports from RIO.PrettyPrint.Types.PrettyPrint

data Style Source #

A style of rio-prettyprint's output.

Instances

Instances details
Semigroup Style Source #

The first style overrides the second.

Instance details

Defined in RIO.PrettyPrint.Types

Methods

(<>) :: Style -> Style -> Style #

sconcat :: NonEmpty Style -> Style #

stimes :: Integral b => b -> Style -> Style #

Bounded Style Source # 
Instance details

Defined in RIO.PrettyPrint.Types

Enum Style Source # 
Instance details

Defined in RIO.PrettyPrint.Types

Ix Style Source # 
Instance details

Defined in RIO.PrettyPrint.Types

Show Style Source # 
Instance details

Defined in RIO.PrettyPrint.Types

Methods

showsPrec :: Int -> Style -> ShowS #

show :: Style -> String #

showList :: [Style] -> ShowS #

Eq Style Source # 
Instance details

Defined in RIO.PrettyPrint.Types

Methods

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

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

Ord Style Source # 
Instance details

Defined in RIO.PrettyPrint.Types

Methods

compare :: Style -> Style -> Ordering #

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

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

(>) :: Style -> Style -> Bool #

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

max :: Style -> Style -> Style #

min :: Style -> Style -> Style #