stack-1.9.3.1: The Haskell Tool Stack

Safe HaskellNone
LanguageHaskell2010

Stack.PrettyPrint

Contents

Synopsis

Pretty printing functions

Logging based on pretty-print typeclass

Semantic styling functions

These are preferred to styling or colors directly, so that we can encourage consistency.

styleWarning :: AnsiDoc -> AnsiDoc Source #

Style an AnsiDoc as a warning. Should be used sparingly, not to style entire long messages. For example, it's used to style the "Warning:" label for an error message, not the entire message.

styleError :: AnsiDoc -> AnsiDoc Source #

Style an AnsiDoc as an error. Should be used sparingly, not to style entire long messages. For example, it's used to style the "Error:" label for an error message, not the entire message.

styleGood :: AnsiDoc -> AnsiDoc Source #

Style an AnsiDoc in a way to emphasize that it is a particularly good thing.

styleShell :: AnsiDoc -> AnsiDoc Source #

Style an AnsiDoc as a shell command, i.e. when suggesting something to the user that should be typed in directly as written.

styleFile :: AnsiDoc -> AnsiDoc Source #

Style an AnsiDoc as a filename. See styleDir for directories.

styleUrl :: AnsiDoc -> AnsiDoc Source #

Style an AsciDoc as a URL. For now using the same style as files.

styleDir :: AnsiDoc -> AnsiDoc Source #

Style an AnsiDoc as a directory name. See styleFile for files.

styleModule :: AnsiDoc -> AnsiDoc Source #

Style an AnsiDoc as a module name

styleCurrent :: AnsiDoc -> AnsiDoc Source #

Style an AnsiDoc in a way that emphasizes that it is related to a current thing. For example, could be used when talking about the current package we're processing when outputting the name of it.

styleRecommendation :: AnsiDoc -> AnsiDoc Source #

Style used to highlight part of a recommended course of action.

Formatting utils

bulletedList :: [AnsiDoc] -> AnsiDoc Source #

Display a bulleted list of AnsiDoc.

spacedBulletedList :: [AnsiDoc] -> AnsiDoc Source #

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

Re-exports from Text.PrettyPrint.Leijen.Extended

class Display a where Source #

Minimal complete definition

Nothing

Associated Types

type Ann a Source #

Methods

display :: a -> Doc (Ann a) Source #

display :: Show a => a -> Doc (Ann a) Source #

Instances
Display ModuleName Source # 
Instance details

Defined in Stack.PrettyPrint

Associated Types

type Ann ModuleName :: Type Source #

Display PackageName Source # 
Instance details

Defined in Stack.PrettyPrint

Associated Types

type Ann PackageName :: Type Source #

Display Version Source # 
Instance details

Defined in Stack.PrettyPrint

Associated Types

type Ann Version :: Type Source #

Display PackageIdentifier Source # 
Instance details

Defined in Stack.PrettyPrint

Associated Types

type Ann PackageIdentifier :: Type Source #

Display (Doc a) Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Associated Types

type Ann (Doc a) :: Type Source #

Methods

display :: Doc a -> Doc (Ann (Doc a)) Source #

Display (PackageName, NamedComponent) Source # 
Instance details

Defined in Stack.PrettyPrint

Associated Types

type Ann (PackageName, NamedComponent) :: Type Source #

Display (Path b Dir) Source # 
Instance details

Defined in Stack.PrettyPrint

Associated Types

type Ann (Path b Dir) :: Type Source #

Methods

display :: Path b Dir -> Doc (Ann (Path b Dir)) Source #

Display (Path b File) Source # 
Instance details

Defined in Stack.PrettyPrint

Associated Types

type Ann (Path b File) :: Type Source #

Methods

display :: Path b File -> Doc (Ann (Path b File)) Source #

newtype AnsiAnn Source #

Constructors

AnsiAnn [SGR] 
Instances
Eq AnsiAnn Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

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

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

Show AnsiAnn Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

showsPrec :: Int -> AnsiAnn -> ShowS

show :: AnsiAnn -> String #

showList :: [AnsiAnn] -> ShowS

Semigroup AnsiAnn Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

(<>) :: AnsiAnn -> AnsiAnn -> AnsiAnn #

sconcat :: NonEmpty AnsiAnn -> AnsiAnn #

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

Monoid AnsiAnn Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

HasAnsiAnn AnsiAnn Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

class HasAnsiAnn a where Source #

Minimal complete definition

getAnsiAnn

data Doc a #

Instances
Functor Doc 
Instance details

Defined in Text.PrettyPrint.Annotated.Leijen

Methods

fmap :: (a -> b) -> Doc a -> Doc b #

(<$) :: a -> Doc b -> Doc a #

Show (Doc a) 
Instance details

Defined in Text.PrettyPrint.Annotated.Leijen

Methods

showsPrec :: Int -> Doc a -> ShowS

show :: Doc a -> String #

showList :: [Doc a] -> ShowS

IsString (Doc a) 
Instance details

Defined in Text.PrettyPrint.Annotated.Leijen

Methods

fromString :: String -> Doc a #

Semigroup (Doc a) Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

(<>) :: Doc a -> Doc a -> Doc a #

sconcat :: NonEmpty (Doc a) -> Doc a #

stimes :: Integral b => b -> Doc a -> Doc a #

Monoid (Doc a) Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

mempty :: Doc a #

mappend :: Doc a -> Doc a -> Doc a #

mconcat :: [Doc a] -> Doc a #

Display (Doc a) Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Associated Types

type Ann (Doc a) :: Type Source #

Methods

display :: Doc a -> Doc (Ann (Doc a)) Source #

type Ann (Doc a) Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

type Ann (Doc a) = a

nest :: Int -> Doc a -> Doc a #

line :: Doc a #

group :: Doc a -> Doc a #

align :: Doc a -> Doc a #

hang :: Int -> Doc a -> Doc a #

indent :: Int -> Doc a -> Doc a #

encloseSep :: Doc a -> Doc a -> Doc a -> [Doc a] -> Doc a #

(<+>) :: Doc a -> Doc a -> Doc a #

hsep :: [Doc a] -> Doc a #

vsep :: [Doc a] -> Doc a #

fillSep :: [Doc a] -> Doc a #

sep :: [Doc a] -> Doc a #

hcat :: [Doc a] -> Doc a #

vcat :: [Doc a] -> Doc a #

fillCat :: [Doc a] -> Doc a #

cat :: [Doc a] -> Doc a #

punctuate :: Doc a -> [Doc a] -> [Doc a] #

fill :: Int -> Doc a -> Doc a #

fillBreak :: Int -> Doc a -> Doc a #

enclose :: Doc a -> Doc a -> Doc a -> Doc a #

squotes :: Doc a -> Doc a #

dquotes :: Doc a -> Doc a #

parens :: Doc a -> Doc a #

angles :: Doc a -> Doc a #

braces :: Doc a -> Doc a #

brackets :: Doc a -> Doc a #

indentAfterLabel :: Doc a -> Doc a 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 -> [Doc a] Source #

Make a Doc from each word in a String

flow :: String -> Doc a Source #

Wordwrap a String

Orphan instances

Display ModuleName Source # 
Instance details

Associated Types

type Ann ModuleName :: Type Source #

Display PackageName Source # 
Instance details

Associated Types

type Ann PackageName :: Type Source #

Display Version Source # 
Instance details

Associated Types

type Ann Version :: Type Source #

Display PackageIdentifier Source # 
Instance details

Associated Types

type Ann PackageIdentifier :: Type Source #

Display (PackageName, NamedComponent) Source # 
Instance details

Associated Types

type Ann (PackageName, NamedComponent) :: Type Source #

Display (Path b Dir) Source # 
Instance details

Associated Types

type Ann (Path b Dir) :: Type Source #

Methods

display :: Path b Dir -> Doc (Ann (Path b Dir)) Source #

Display (Path b File) Source # 
Instance details

Associated Types

type Ann (Path b File) :: Type Source #

Methods

display :: Path b File -> Doc (Ann (Path b File)) Source #