rio-prettyprint-0.1.1.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 #

class HasStylesUpdate env where Source #

Environment values with a styles update.

Since: 0.1.0.0

Instances

Instances details
HasStylesUpdate StylesUpdate Source # 
Instance details

Defined in RIO.PrettyPrint.StylesUpdate

Pretty printing functions

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.

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.

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

newtype StyleAnn Source #

A style annotation.

Constructors

StyleAnn (Maybe Style) 

Instances

Instances details
Eq StyleAnn Source # 
Instance details

Defined in Text.PrettyPrint.Leijen.Extended

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

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

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