rio-prettyprint-0.1.0.0: Pretty-printing for RIO
Safe HaskellNone
LanguageHaskell2010

RIO.PrettyPrint

Synopsis

Type classes for optionally colored terminal output

class (HasLogFunc env, HasStylesUpdate env) => HasTerm env where Source #

Methods

useColorL :: Lens' env Bool Source #

termWidthL :: Lens' env Int Source #

class HasStylesUpdate env where Source #

Environment values with a styles update.

Since: 0.1.0.0

Methods

stylesUpdateL :: Lens' env StylesUpdate Source #

Instances

Instances details
HasStylesUpdate StylesUpdate Source # 
Instance details

Defined in RIO.PrettyPrint.StylesUpdate

Pretty printing functions

displayPlain :: (Pretty a, HasLogFunc env, HasStylesUpdate env, MonadReader env m, HasCallStack) => Int -> a -> m Utf8Builder Source #

displayWithColor :: (HasTerm env, Pretty a, MonadReader env m, HasCallStack) => a -> m Utf8Builder Source #

Logging based on pretty-print typeclass

prettyDebug :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () Source #

prettyInfo :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () Source #

prettyNote :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () Source #

prettyWarn :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () Source #

prettyError :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () Source #

prettyWarnNoIndent :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () Source #

prettyErrorNoIndent :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m () Source #

prettyDebugL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () Source #

prettyInfoL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () Source #

prettyNoteL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () Source #

prettyWarnL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () Source #

prettyErrorL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () Source #

prettyWarnNoIndentL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () Source #

prettyErrorNoIndentL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m () Source #

prettyDebugS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m () Source #

prettyInfoS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m () Source #

prettyNoteS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m () Source #

prettyWarnS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m () Source #

prettyErrorS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m () Source #

prettyWarnNoIndentS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m () Source #

prettyErrorNoIndentS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m () Source #

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.

Formatting utils

bulletedList :: [StyleDoc] -> StyleDoc Source #

Display a bulleted list of StyleDoc.

spacedBulletedList :: [StyleDoc] -> StyleDoc Source #

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

debugBracket :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m, MonadUnliftIO m) => StyleDoc -> m a -> m a Source #

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

Methods

pretty :: ModuleName -> StyleDoc Source #

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

Instances

Instances details
IsString StyleDoc Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

fromString :: String -> StyleDoc

Semigroup StyleDoc Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

(<>) :: StyleDoc -> StyleDoc -> StyleDoc

sconcat :: NonEmpty StyleDoc -> StyleDoc

stimes :: Integral b => b -> StyleDoc -> StyleDoc

Monoid StyleDoc Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Pretty StyleDoc Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

newtype StyleAnn Source #

A style annotation.

Constructors

StyleAnn (Maybe Style) 

Instances

Instances details
Eq StyleAnn Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

(==) :: StyleAnn -> StyleAnn -> Bool

(/=) :: StyleAnn -> StyleAnn -> Bool

Show StyleAnn Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

showsPrec :: Int -> StyleAnn -> ShowS

show :: StyleAnn -> String

showList :: [StyleAnn] -> ShowS

Semigroup StyleAnn Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

Methods

(<>) :: StyleAnn -> StyleAnn -> StyleAnn

sconcat :: NonEmpty StyleAnn -> StyleAnn

stimes :: Integral b => b -> StyleAnn -> StyleAnn

Monoid StyleAnn Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

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
Bounded Style Source # 
Instance details

Defined in RIO.PrettyPrint.Types

Enum Style Source # 
Instance details

Defined in RIO.PrettyPrint.Types

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

Show Style Source # 
Instance details

Defined in RIO.PrettyPrint.Types

Methods

showsPrec :: Int -> Style -> ShowS

show :: Style -> String

showList :: [Style] -> ShowS

Ix Style Source # 
Instance details

Defined in RIO.PrettyPrint.Types

Methods

range :: (Style, Style) -> [Style]

index :: (Style, Style) -> Style -> Int

unsafeIndex :: (Style, Style) -> Style -> Int

inRange :: (Style, Style) -> Style -> Bool

rangeSize :: (Style, Style) -> Int

unsafeRangeSize :: (Style, Style) -> Int

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