-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Pretty-printing for RIO
--   
--   Combine RIO's log capabilities with pretty printing
@package rio-prettyprint
@version 0.1.8.0


-- | For the most part, the data constructors of <a>Style</a> do not clash
--   with other names. When they do, import the module qualified. For
--   example:
--   
--   <pre>
--   import qualified RIO.PrettyPrint.Types.PrettyPrint as PP
--   </pre>
module RIO.PrettyPrint.Types

-- | Type representing styles of output.
data Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the <tt>Error:</tt> or <tt>[error]</tt> label for an
--   error message, not the entire message.
Error :: Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the <tt>Warning:</tt> or <tt>[warn]</tt> label for a
--   warning message, not the entire message.
Warning :: Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the <tt>[info]</tt> label for an info message, not
--   the entire message.
Info :: Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the <tt>[debug]</tt> label for a debug message, not
--   the entire message.
Debug :: Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the <tt>[...]</tt> label for an other log level
--   message, not the entire message.
OtherLevel :: Style

-- | Style in a way to emphasize that it is a particularly good thing.
Good :: Style

-- | Style as a shell command, i.e. when suggesting something to the user
--   that should be typed in directly as written.
Shell :: Style

-- | Style as a filename. See <a>Dir</a> for directories.
File :: Style

-- | Style as a URL.
Url :: Style

-- | Style as a directory name. See <a>File</a> for files.
Dir :: Style

-- | Style used to highlight part of a recommended course of action.
Recommendation :: Style

-- | Style in a way that emphasizes that it is related to a current thing.
--   For example, to report the current package that is being processed
--   when outputting the name of it.
Current :: Style

-- | Style used the highlight the target of a course of action.
Target :: Style

-- | Style as a module name.
Module :: Style

-- | Style used to highlight the named component of a package.
PkgComponent :: Style

-- | Style for secondary content. For example, to style timestamps.
Secondary :: Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the duration in a <tt>Finished process in ...
--   ms</tt> message.
Highlight :: Style

-- | Style specifications indexed by the style.
type Styles = Array Style StyleSpec

-- | A style specification, pairing its 'key' with the corresponding list
--   of <a>SGR</a> codes.
type StyleSpec = (Text, [SGR])
instance GHC.Internal.Enum.Bounded RIO.PrettyPrint.Types.Style
instance GHC.Internal.Enum.Enum RIO.PrettyPrint.Types.Style
instance GHC.Classes.Eq RIO.PrettyPrint.Types.Style
instance GHC.Internal.Ix.Ix RIO.PrettyPrint.Types.Style
instance GHC.Classes.Ord RIO.PrettyPrint.Types.Style
instance GHC.Internal.Base.Semigroup RIO.PrettyPrint.Types.Style
instance GHC.Internal.Show.Show RIO.PrettyPrint.Types.Style

module RIO.PrettyPrint.DefaultStyles

-- | Default styles for rio-prettyprint output.
defaultStyles :: Styles

module RIO.PrettyPrint.StylesUpdate

-- | Updates to <tt>Styles</tt>
newtype StylesUpdate
StylesUpdate :: [(Style, StyleSpec)] -> StylesUpdate
[stylesUpdate] :: StylesUpdate -> [(Style, StyleSpec)]

-- | Parse a string that is a colon-delimited sequence of key=value, where
--   <tt>key</tt> is a style name and <tt>value</tt> is a
--   semicolon-delimited list of <tt>ANSI</tt> SGR (Select Graphic
--   Rendition) control codes (in decimal). Keys that are not present in
--   <a>defaultStyles</a> are ignored. Items in the semicolon-delimited
--   list that are not recognised as valid control codes are ignored.
parseStylesUpdateFromString :: String -> StylesUpdate

-- | Environment values with a styles update.
class HasStylesUpdate env
stylesUpdateL :: HasStylesUpdate env => Lens' env StylesUpdate
instance GHC.Classes.Eq RIO.PrettyPrint.StylesUpdate.StylesUpdate
instance Data.Aeson.Types.FromJSON.FromJSON RIO.PrettyPrint.StylesUpdate.StylesUpdate
instance RIO.PrettyPrint.StylesUpdate.HasStylesUpdate RIO.PrettyPrint.StylesUpdate.StylesUpdate
instance GHC.Internal.Base.Monoid RIO.PrettyPrint.StylesUpdate.StylesUpdate
instance GHC.Internal.Base.Semigroup RIO.PrettyPrint.StylesUpdate.StylesUpdate
instance GHC.Internal.Show.Show RIO.PrettyPrint.StylesUpdate.StylesUpdate


-- | This module is based, in part, on some of the interface for
--   <a>Text.PrettyPrint.Annotated.Leijen</a>.
module Text.PrettyPrint.Leijen.Extended
class Pretty a
pretty :: Pretty a => a -> StyleDoc
($dmpretty) :: (Pretty a, Show a) => a -> StyleDoc

-- | A document annotated by a style.
newtype StyleDoc
StyleDoc :: Doc StyleAnn -> StyleDoc
[unStyleDoc] :: StyleDoc -> Doc StyleAnn

-- | A style annotation.
newtype StyleAnn
StyleAnn :: Maybe Style -> StyleAnn
displayAnsi :: (Pretty a, HasLogFunc env, HasStylesUpdate env, MonadReader env m, HasCallStack) => Int -> a -> m Utf8Builder
displayPlain :: (Pretty a, HasLogFunc env, HasStylesUpdate env, MonadReader env m, HasCallStack) => Int -> a -> m Utf8Builder
renderDefault :: Int -> Doc a -> SimpleDoc a

-- | The document <tt>(nest i x)</tt> renders document <tt>x</tt> with the
--   current indentation level increased by i (See also <a>hang</a>,
--   <a>align</a> and <a>indent</a>).
--   
--   <pre>
--      nest 2 (fromString "hello" &lt;&gt; line &lt;&gt; fromString "world")
--   &lt;&gt; line
--   &lt;&gt; fromString "!"
--   </pre>
--   
--   outputs as:
--   
--   <pre>
--   hello
--     world
--   !
--   </pre>
nest :: Int -> StyleDoc -> StyleDoc

-- | The <tt>line</tt> document advances to the next line and indents to
--   the current nesting level. Document <tt>line</tt> behaves like
--   <tt>(fromString " ")</tt> if the line break is undone by <a>group</a>.
line :: StyleDoc

-- | The <tt>linebreak</tt> document advances to the next line and indents
--   to the current nesting level. Document <tt>linebreak</tt> behaves like
--   <a>mempty</a> if the line break is undone by <a>group</a>.
linebreak :: StyleDoc

-- | The <tt>group</tt> combinator is used to specify alternative layouts.
--   The document <tt>(group x)</tt> undoes all line breaks in document
--   <tt>x</tt>. The resulting line is added to the current line if that
--   fits the page. Otherwise, the document <tt>x</tt> is rendered without
--   any changes.
group :: StyleDoc -> StyleDoc

-- | The document <tt>softline</tt> behaves like <tt>(fromString " ")</tt>
--   if the resulting output fits the page, otherwise it behaves like
--   <a>line</a>.
--   
--   <pre>
--   softline = group line
--   </pre>
softline :: StyleDoc

-- | The document <tt>softbreak</tt> behaves like <a>mempty</a> if the
--   resulting output fits the page, otherwise it behaves like <a>line</a>.
--   
--   <pre>
--   softbreak = group linebreak
--   </pre>
softbreak :: StyleDoc

-- | The document <tt>(align x)</tt> renders document <tt>x</tt> with the
--   nesting level set to the current column. It is used for example to
--   implement <a>hang</a>.
--   
--   As an example, we will put a document right above another one,
--   regardless of the current nesting level:
--   
--   <pre>
--   x $$ y = align (x &lt;&gt; line &lt;&gt; y)
--   </pre>
--   
--   <pre>
--   test = fromString "hi" &lt;+&gt; (fromString "nice" $$ fromString "world")
--   </pre>
--   
--   which will be layed out as:
--   
--   <pre>
--   hi nice
--      world
--   </pre>
align :: StyleDoc -> StyleDoc

-- | The hang combinator implements hanging indentation. The document
--   <tt>(hang i x)</tt> renders document <tt>x</tt> with a nesting level
--   set to the current column plus <tt>i</tt>. The following example uses
--   hanging indentation for some text:
--   
--   <pre>
--   test = hang 4 (fillSep (map fromString
--          (words "the hang combinator indents these words !")))
--   </pre>
--   
--   Which lays out on a page with a width of 20 characters as:
--   
--   <pre>
--   the hang combinator
--       indents these
--       words !
--   </pre>
--   
--   The <tt>hang</tt> combinator is implemented as:
--   
--   <pre>
--   hang i x = align (nest i x)
--   </pre>
hang :: Int -> StyleDoc -> StyleDoc

-- | The document <tt>(indent i x)</tt> indents document <tt>x</tt> with
--   <tt>i</tt> spaces.
--   
--   <pre>
--   test = indent 4 (fillSep (map fromString
--          (words "the indent combinator indents these words !")))
--   </pre>
--   
--   Which lays out with a page width of 20 as:
--   
--   <pre>
--   the indent
--   combinator
--   indents these
--   words !
--   </pre>
indent :: Int -> StyleDoc -> StyleDoc

-- | The document <tt>(encloseSep l r sep xs)</tt> concatenates the
--   documents <tt>xs</tt> separated by <tt>sep</tt> and encloses the
--   resulting document by <tt>l</tt> and <tt>r</tt>. The documents are
--   rendered horizontally if that fits the page. Otherwise they are
--   aligned vertically. All separators are put in front of the elements.
--   For example, the combinator <tt>list</tt> can be defined with
--   <a>encloseSep</a>:
--   
--   <pre>
--   list xs = encloseSep lbracket rbracket comma xs
--   test = fromString "list" &lt;+&gt; (list (map int [10, 200, 3000]))
--   </pre>
--   
--   Which is layed out with a page width of 20 as:
--   
--   <pre>
--   list [10,200,3000]
--   </pre>
--   
--   But when the page width is 15, it is layed out as:
--   
--   <pre>
--   list [10
--        ,200
--        ,3000]
--   </pre>
encloseSep :: StyleDoc -> StyleDoc -> StyleDoc -> [StyleDoc] -> StyleDoc

-- | The document <tt>(x &lt;+&gt; y)</tt> concatenates document <tt>x</tt>
--   and <tt>y</tt> with a <tt>(fromString " ")</tt> in between. (infixr 6)
(<+>) :: StyleDoc -> StyleDoc -> StyleDoc

-- | The document <tt>(hsep xs)</tt> concatenates all documents <tt>xs</tt>
--   horizontally with <tt>(<a>&lt;+&gt;</a>)</tt>.
hsep :: [StyleDoc] -> StyleDoc

-- | The document <tt>(vsep xs)</tt> concatenates all documents <tt>xs</tt>
--   vertically with <tt>(&lt;&gt; line &lt;&gt;)</tt>. If a <a>group</a>
--   undoes the line breaks inserted by <a>vsep</a>, all documents are
--   separated with a space.
--   
--   <pre>
--   someText = map fromString (words ("text to lay out"))
--   
--   test = fromString "some" &lt;+&gt; vsep someText
--   </pre>
--   
--   This is layed out as:
--   
--   <pre>
--   some text
--   to
--   lay
--   out
--   </pre>
--   
--   The <a>align</a> combinator can be used to align the documents under
--   their first element
--   
--   <pre>
--   test = fromString "some" &lt;+&gt; align (vsep someText)
--   </pre>
--   
--   Which is printed as:
--   
--   <pre>
--   some text
--        to
--        lay
--        out
--   </pre>
vsep :: [StyleDoc] -> StyleDoc

-- | The document <tt>(fillSep xs)</tt> concatenates documents <tt>xs</tt>
--   horizontally with <tt>(<a>&lt;+&gt;</a>)</tt> as long as its fits the
--   page, than inserts a <a>line</a> and continues doing that for all
--   documents in <tt>xs</tt>.
--   
--   <pre>
--   fillSep xs = foldr (&lt;&gt; softline &lt;&gt;) mempty xs
--   </pre>
fillSep :: [StyleDoc] -> StyleDoc

-- | The document <tt>(sep xs)</tt> concatenates all documents <tt>xs</tt>
--   either horizontally with <tt>(&lt;+&gt;)</tt>, if it fits the page, or
--   vertically with <tt>(&lt;&gt; line &lt;&gt;)</tt>.
--   
--   <pre>
--   sep xs = group (vsep xs)
--   </pre>
sep :: [StyleDoc] -> StyleDoc

-- | The document <tt>(hcat xs)</tt> concatenates all documents <tt>xs</tt>
--   horizontally with <tt>(&lt;&gt;)</tt>.
hcat :: [StyleDoc] -> StyleDoc

-- | The document <tt>(vcat xs)</tt> concatenates all documents <tt>xs</tt>
--   vertically with <tt>(&lt;&gt; linebreak &lt;&gt;)</tt>. If a
--   <a>group</a> undoes the line breaks inserted by <a>vcat</a>, all
--   documents are directly concatenated.
vcat :: [StyleDoc] -> StyleDoc

-- | The document <tt>(fillCat xs)</tt> concatenates documents <tt>xs</tt>
--   horizontally with <tt>(&lt;&gt;)</tt> as long as its fits the page,
--   than inserts a <tt>linebreak</tt> and continues doing that for all
--   documents in <tt>xs</tt>.
--   
--   <pre>
--   fillCat xs = foldr (&lt;&gt; softbreak &lt;&gt;) mempty xs
--   </pre>
fillCat :: [StyleDoc] -> StyleDoc

-- | The document <tt>(cat xs)</tt> concatenates all documents <tt>xs</tt>
--   either horizontally with <tt>(&lt;&gt;)</tt>, if it fits the page, or
--   vertically with <tt>(&lt;&gt; linebreak &lt;&gt;)</tt>.
--   
--   <pre>
--   cat xs = group (vcat xs)
--   </pre>
cat :: [StyleDoc] -> StyleDoc

-- | <tt>(punctuate p xs)</tt> concatenates all documents in <tt>xs</tt>
--   with document <tt>p</tt> except for the last document.
--   
--   <pre>
--   someText = map fromString ["words", "in", "a", "tuple"]
--   test = parens (align (cat (punctuate comma someText)))
--   </pre>
--   
--   This is layed out on a page width of 20 as:
--   
--   <pre>
--   (words,in,a,tuple)
--   </pre>
--   
--   But when the page width is 15, it is layed out as:
--   
--   <pre>
--   (words,
--    in,
--    a,
--    tuple)
--   </pre>
--   
--   (If you want put the commas in front of their elements instead of at
--   the end, you should use <a>encloseSep</a>.)
punctuate :: StyleDoc -> [StyleDoc] -> [StyleDoc]

-- | The document <tt>(fill i x)</tt> renders document <tt>x</tt>. It than
--   appends <tt>(fromString " ")</tt>s until the width is equal to
--   <tt>i</tt>. If the width of <tt>x</tt> is already larger, nothing is
--   appended. This combinator is quite useful in practice to output a list
--   of bindings. The following example demonstrates this.
--   
--   <pre>
--   types = [ ("empty", "Doc a")
--           , ("nest", "Int -&gt; Doc a -&gt; Doc a")
--           , ("linebreak", "Doc a")
--           ]
--   
--   ptype (name, tp) =
--     fill 6 (fromString name) &lt;+&gt; fromString "::" &lt;+&gt; fromString tp
--   
--   test = fromString "let" &lt;+&gt; align (vcat (map ptype types))
--   </pre>
--   
--   Which is layed out as:
--   
--   <pre>
--   let empty  :: Doc a
--       nest   :: Int -&gt; Doc a -&gt; Doc a
--       linebreak :: Doc a
--   </pre>
fill :: Int -> StyleDoc -> StyleDoc

-- | The document <tt>(fillBreak i x)</tt> first renders document
--   <tt>x</tt>. It then appends <tt>(fromString " ")</tt>s until the width
--   is equal to <tt>i</tt>. If the width of <tt>x</tt> is already larger
--   than <tt>i</tt>, the nesting level is increased by <tt>i</tt> and a
--   <tt>line</tt> is appended. When we redefine <tt>ptype</tt> in the
--   previous example to use <tt>fillBreak</tt>, we get a useful variation
--   of the previous output:
--   
--   <pre>
--   ptype (name, tp) =
--     fillBreak 6 (fromString name) &lt;+&gt; fromString "::" &lt;+&gt; fromString tp
--   </pre>
--   
--   The output will now be:
--   
--   <pre>
--   let empty  :: Doc a
--       nest   :: Int -&gt; Doc a -&gt; Doc a
--       linebreak
--              :: Doc a
--   </pre>
fillBreak :: Int -> StyleDoc -> StyleDoc

-- | The document <tt>(enclose l r x)</tt> encloses document <tt>x</tt>
--   between documents <tt>l</tt> and <tt>r</tt> using <tt>(&lt;&gt;)</tt>.
--   
--   <pre>
--   enclose l r x   = l &lt;&gt; x &lt;&gt; r
--   </pre>
enclose :: StyleDoc -> StyleDoc -> StyleDoc -> StyleDoc

-- | Document <tt>(squotes x)</tt> encloses document <tt>x</tt> with single
--   quotes "'".
squotes :: StyleDoc -> StyleDoc

-- | Document <tt>(dquotes x)</tt> encloses document <tt>x</tt> with double
--   quotes '"'.
dquotes :: StyleDoc -> StyleDoc

-- | Document <tt>(parens x)</tt> encloses document <tt>x</tt> in
--   parenthesis, "(" and ")".
parens :: StyleDoc -> StyleDoc

-- | Document <tt>(angles x)</tt> encloses document <tt>x</tt> in angles,
--   "&lt;" and "&gt;".
angles :: StyleDoc -> StyleDoc

-- | Document <tt>(braces x)</tt> encloses document <tt>x</tt> in braces,
--   "{" and "}".
braces :: StyleDoc -> StyleDoc

-- | Document <tt>(brackets x)</tt> encloses document <tt>x</tt> in square
--   brackets, "[" and "]".
brackets :: StyleDoc -> StyleDoc

-- | The document <tt>string s</tt> concatenates all characters in
--   <tt>s</tt> using <tt>line</tt> for newline characters and
--   <tt>fromString</tt> for all other characters. It is used whenever the
--   text contains newline characters.
string :: String -> StyleDoc
annotate :: StyleAnn -> StyleDoc -> StyleDoc

-- | Strip annotations from a document. This is useful for re-using the
--   textual formatting of some sub-document, but applying a different
--   high-level annotation.
noAnnotate :: StyleDoc -> StyleDoc
styleAnn :: Style -> StyleDoc -> StyleDoc
instance GHC.Classes.Eq Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance GHC.Classes.Eq Text.PrettyPrint.Leijen.Extended.SGRTag
instance GHC.Classes.Eq Text.PrettyPrint.Leijen.Extended.StyleAnn
instance GHC.Internal.Data.String.IsString Text.PrettyPrint.Leijen.Extended.StyleDoc
instance GHC.Internal.Base.Monoid Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance GHC.Internal.Base.Monoid Text.PrettyPrint.Leijen.Extended.StyleAnn
instance GHC.Internal.Base.Monoid Text.PrettyPrint.Leijen.Extended.StyleDoc
instance GHC.Classes.Ord Text.PrettyPrint.Leijen.Extended.SGRTag
instance Text.PrettyPrint.Leijen.Extended.Pretty Distribution.System.Arch
instance Text.PrettyPrint.Leijen.Extended.Pretty Distribution.ModuleName.ModuleName
instance Text.PrettyPrint.Leijen.Extended.Pretty Distribution.System.OS
instance Text.PrettyPrint.Leijen.Extended.Pretty (Path.Internal.Posix.Path b Path.Posix.File)
instance Text.PrettyPrint.Leijen.Extended.Pretty (Path.Internal.Posix.Path b Path.Posix.Dir)
instance Text.PrettyPrint.Leijen.Extended.Pretty (Path.Posix.SomeBase Path.Posix.File)
instance Text.PrettyPrint.Leijen.Extended.Pretty (Path.Posix.SomeBase Path.Posix.Dir)
instance Text.PrettyPrint.Leijen.Extended.Pretty Text.PrettyPrint.Leijen.Extended.StyleDoc
instance GHC.Internal.Base.Semigroup Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance GHC.Internal.Base.Semigroup Text.PrettyPrint.Leijen.Extended.StyleAnn
instance GHC.Internal.Base.Semigroup Text.PrettyPrint.Leijen.Extended.StyleDoc
instance GHC.Internal.Show.Show Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance GHC.Internal.Show.Show Text.PrettyPrint.Leijen.Extended.StyleAnn
instance GHC.Internal.Show.Show Text.PrettyPrint.Leijen.Extended.StyleDoc


-- | This module provides a type representing pretty exceptions. It can be
--   used as in the example below:
--   
--   <pre>
--   {-# LANGUAGE NoImplicitPrelude #-}
--   {-# LANGUAGE OverloadedStrings #-}
--   
--   module Main (main) where
--   
--   import RIO
--            ( Exception, Handler (..), IO, RIO, Show, SomeException (..), Typeable
--            , ($), catches, displayException, exitFailure, fromString, logError
--            , mempty, throwIO
--            )
--   import RIO.PrettyPrint
--            ( Pretty (..), Style (..), (&lt;+&gt;), prettyError, prettyInfo, style )
--   import RIO.PrettyPrint.PrettyException ( PrettyException (..) )
--   import RIO.PrettyPrint.Simple ( SimplePrettyApp, runSimplePrettyApp )
--   
--   main :: IO ()
--   main = runSimplePrettyApp 80 mempty (action `catches` handleExceptions)
--    where
--     action :: RIO SimplePrettyApp ()
--     action = do
--         prettyInfo "Running action!"
--         throwIO (PrettyException MyPrettyException)
--   
--    handleExceptions :: [Handler (RIO SimplePrettyApp) ()]
--    handleExceptions =
--      [ Handler handlePrettyException
--      , Handler handleSomeException
--      ]
--   
--    handlePrettyException :: PrettyException -&gt; RIO SimplePrettyApp ()
--    handlePrettyException e = do
--      prettyError $ pretty e
--      exitFailure
--   
--    handleSomeException :: SomeException -&gt; RIO SimplePrettyApp ()
--    handleSomeException (SomeException e) = do
--      logError $ fromString $ displayException e
--      exitFailure
--   
--   data MyPrettyException
--     = MyPrettyException
--     deriving (Show, Typeable)
--   
--   instance Pretty MyPrettyException where
--     pretty MyPrettyException =
--       "My" &lt;+&gt; style Highlight "pretty" &lt;+&gt; "exception!"
--   
--   instance Exception MyPrettyException
--   </pre>
module RIO.PrettyPrint.PrettyException

-- | Type representing pretty exceptions.
data PrettyException
PrettyException :: e -> PrettyException

-- | Provide the prettiest available information about an exception.
ppException :: SomeException -> StyleDoc

-- | Synchronously throw the given exception as a <a>PrettyException</a>.
prettyThrowIO :: (Exception e, MonadIO m, Pretty e) => e -> m a

-- | Throw the given exception as a <a>PrettyException</a>, when the action
--   is run in the monad <tt>m</tt>.
prettyThrowM :: (Exception e, MonadThrow m, Pretty e) => e -> m a
instance GHC.Internal.Exception.Type.Exception RIO.PrettyPrint.PrettyException.PrettyException
instance Text.PrettyPrint.Leijen.Extended.Pretty RIO.PrettyPrint.PrettyException.PrettyException
instance GHC.Internal.Show.Show RIO.PrettyPrint.PrettyException.PrettyException

module RIO.PrettyPrint
class (HasLogFunc env, HasStylesUpdate env) => HasTerm env
useColorL :: HasTerm env => Lens' env Bool
termWidthL :: HasTerm env => Lens' env Int

-- | Environment values with a styles update.
class HasStylesUpdate env
stylesUpdateL :: HasStylesUpdate env => Lens' env StylesUpdate
displayPlain :: (Pretty a, HasLogFunc env, HasStylesUpdate env, MonadReader env m, HasCallStack) => Int -> a -> m Utf8Builder
displayWithColor :: (HasTerm env, Pretty a, MonadReader env m, HasCallStack) => a -> m Utf8Builder
prettyDebug :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyDebugL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyDebugS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyInfo :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyInfoL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyInfoS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyNote :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyNoteL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyNoteS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyWarn :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyWarnL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyWarnS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyWarnNoIndent :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyWarnNoIndentL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyWarnNoIndentS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyError :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyErrorL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyErrorS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyErrorNoIndent :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyErrorNoIndentL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyErrorNoIndentS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyGeneric :: (HasTerm env, HasCallStack, Pretty b, MonadReader env m, MonadIO m) => LogLevel -> b -> m ()
prettyWith :: (HasTerm env, HasCallStack, Pretty b, MonadReader env m, MonadIO m) => LogLevel -> (a -> b) -> a -> m ()

-- | Annotate a <a>StyleDoc</a> with a <a>Style</a>.
style :: Style -> StyleDoc -> StyleDoc

-- | Display as milliseconds in style <a>Good</a>.
displayMilliseconds :: Double -> StyleDoc

-- | The <a>Style</a> intended to be associated with a <a>LogLevel</a>.
logLevelToStyle :: LogLevel -> Style

-- | A blank line.
blankLine :: StyleDoc

-- | Display a bulleted list of <a>StyleDoc</a> with <tt>*</tt> as the
--   bullet point.
bulletedList :: [StyleDoc] -> StyleDoc

-- | Display a bulleted list of <a>StyleDoc</a> with a blank line between
--   each and <tt>*</tt> as the bullet point.
spacedBulletedList :: [StyleDoc] -> StyleDoc

-- | Display a bulleted list of <a>StyleDoc</a>, spaced with blank lines or
--   not, given a character for the bullet point.
mkBulletedList :: Bool -> Char -> [StyleDoc] -> StyleDoc

-- | A helper function to yield a narrative list from a list of items, with
--   a final fullstop. For example, helps produce the output <tt>"apple,
--   ball and cat."</tt> (no serial comma) or <tt>"apple, ball, and
--   cat."</tt> (serial comma) from <tt>["apple", "ball", "cat"]</tt>.
mkNarrativeList :: Pretty a => Maybe Style -> Bool -> [a] -> [StyleDoc]

-- | <tt>debug message action</tt> brackets any output of the specified
--   <tt>action</tt> with an initial and final <tt>message</tt> at log
--   level <a>LevelDebug</a>. The initial message is prefixed with the
--   label <tt>Start:</tt>. The final message is prefixed with information
--   about the duration of the action in milliseconds (ms) and, if an
--   exception is thrown by the action, the exception. For example:
--   
--   <pre>
--   Start: &lt;message&gt;
--   &lt;output of action&gt;
--   Finished in ...ms: &lt;message&gt;
--   </pre>
--   
--   or:
--   
--   <pre>
--   Start: &lt;message&gt;
--   &lt;output of action&gt;
--   Finished with exception in ...ms: &lt;message&gt;
--   Exception thrown: &lt;exception_message&gt;
--   </pre>
debugBracket :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m, MonadUnliftIO m) => StyleDoc -> m a -> m a
class Pretty a
pretty :: Pretty a => a -> StyleDoc
($dmpretty) :: (Pretty a, Show a) => a -> StyleDoc

-- | A document annotated by a style.
data StyleDoc

-- | A style annotation.
newtype StyleAnn
StyleAnn :: Maybe Style -> StyleAnn

-- | The document <tt>(nest i x)</tt> renders document <tt>x</tt> with the
--   current indentation level increased by i (See also <a>hang</a>,
--   <a>align</a> and <a>indent</a>).
--   
--   <pre>
--      nest 2 (fromString "hello" &lt;&gt; line &lt;&gt; fromString "world")
--   &lt;&gt; line
--   &lt;&gt; fromString "!"
--   </pre>
--   
--   outputs as:
--   
--   <pre>
--   hello
--     world
--   !
--   </pre>
nest :: Int -> StyleDoc -> StyleDoc

-- | The <tt>line</tt> document advances to the next line and indents to
--   the current nesting level. Document <tt>line</tt> behaves like
--   <tt>(fromString " ")</tt> if the line break is undone by <a>group</a>.
line :: StyleDoc

-- | The <tt>linebreak</tt> document advances to the next line and indents
--   to the current nesting level. Document <tt>linebreak</tt> behaves like
--   <a>mempty</a> if the line break is undone by <a>group</a>.
linebreak :: StyleDoc

-- | The <tt>group</tt> combinator is used to specify alternative layouts.
--   The document <tt>(group x)</tt> undoes all line breaks in document
--   <tt>x</tt>. The resulting line is added to the current line if that
--   fits the page. Otherwise, the document <tt>x</tt> is rendered without
--   any changes.
group :: StyleDoc -> StyleDoc

-- | The document <tt>softline</tt> behaves like <tt>(fromString " ")</tt>
--   if the resulting output fits the page, otherwise it behaves like
--   <a>line</a>.
--   
--   <pre>
--   softline = group line
--   </pre>
softline :: StyleDoc

-- | The document <tt>softbreak</tt> behaves like <a>mempty</a> if the
--   resulting output fits the page, otherwise it behaves like <a>line</a>.
--   
--   <pre>
--   softbreak = group linebreak
--   </pre>
softbreak :: StyleDoc

-- | The document <tt>(align x)</tt> renders document <tt>x</tt> with the
--   nesting level set to the current column. It is used for example to
--   implement <a>hang</a>.
--   
--   As an example, we will put a document right above another one,
--   regardless of the current nesting level:
--   
--   <pre>
--   x $$ y = align (x &lt;&gt; line &lt;&gt; y)
--   </pre>
--   
--   <pre>
--   test = fromString "hi" &lt;+&gt; (fromString "nice" $$ fromString "world")
--   </pre>
--   
--   which will be layed out as:
--   
--   <pre>
--   hi nice
--      world
--   </pre>
align :: StyleDoc -> StyleDoc

-- | The hang combinator implements hanging indentation. The document
--   <tt>(hang i x)</tt> renders document <tt>x</tt> with a nesting level
--   set to the current column plus <tt>i</tt>. The following example uses
--   hanging indentation for some text:
--   
--   <pre>
--   test = hang 4 (fillSep (map fromString
--          (words "the hang combinator indents these words !")))
--   </pre>
--   
--   Which lays out on a page with a width of 20 characters as:
--   
--   <pre>
--   the hang combinator
--       indents these
--       words !
--   </pre>
--   
--   The <tt>hang</tt> combinator is implemented as:
--   
--   <pre>
--   hang i x = align (nest i x)
--   </pre>
hang :: Int -> StyleDoc -> StyleDoc

-- | The document <tt>(indent i x)</tt> indents document <tt>x</tt> with
--   <tt>i</tt> spaces.
--   
--   <pre>
--   test = indent 4 (fillSep (map fromString
--          (words "the indent combinator indents these words !")))
--   </pre>
--   
--   Which lays out with a page width of 20 as:
--   
--   <pre>
--   the indent
--   combinator
--   indents these
--   words !
--   </pre>
indent :: Int -> StyleDoc -> StyleDoc

-- | The document <tt>(encloseSep l r sep xs)</tt> concatenates the
--   documents <tt>xs</tt> separated by <tt>sep</tt> and encloses the
--   resulting document by <tt>l</tt> and <tt>r</tt>. The documents are
--   rendered horizontally if that fits the page. Otherwise they are
--   aligned vertically. All separators are put in front of the elements.
--   For example, the combinator <tt>list</tt> can be defined with
--   <a>encloseSep</a>:
--   
--   <pre>
--   list xs = encloseSep lbracket rbracket comma xs
--   test = fromString "list" &lt;+&gt; (list (map int [10, 200, 3000]))
--   </pre>
--   
--   Which is layed out with a page width of 20 as:
--   
--   <pre>
--   list [10,200,3000]
--   </pre>
--   
--   But when the page width is 15, it is layed out as:
--   
--   <pre>
--   list [10
--        ,200
--        ,3000]
--   </pre>
encloseSep :: StyleDoc -> StyleDoc -> StyleDoc -> [StyleDoc] -> StyleDoc

-- | The document <tt>(x &lt;+&gt; y)</tt> concatenates document <tt>x</tt>
--   and <tt>y</tt> with a <tt>(fromString " ")</tt> in between. (infixr 6)
(<+>) :: StyleDoc -> StyleDoc -> StyleDoc

-- | The document <tt>(hsep xs)</tt> concatenates all documents <tt>xs</tt>
--   horizontally with <tt>(<a>&lt;+&gt;</a>)</tt>.
hsep :: [StyleDoc] -> StyleDoc

-- | The document <tt>(vsep xs)</tt> concatenates all documents <tt>xs</tt>
--   vertically with <tt>(&lt;&gt; line &lt;&gt;)</tt>. If a <a>group</a>
--   undoes the line breaks inserted by <a>vsep</a>, all documents are
--   separated with a space.
--   
--   <pre>
--   someText = map fromString (words ("text to lay out"))
--   
--   test = fromString "some" &lt;+&gt; vsep someText
--   </pre>
--   
--   This is layed out as:
--   
--   <pre>
--   some text
--   to
--   lay
--   out
--   </pre>
--   
--   The <a>align</a> combinator can be used to align the documents under
--   their first element
--   
--   <pre>
--   test = fromString "some" &lt;+&gt; align (vsep someText)
--   </pre>
--   
--   Which is printed as:
--   
--   <pre>
--   some text
--        to
--        lay
--        out
--   </pre>
vsep :: [StyleDoc] -> StyleDoc

-- | The document <tt>(fillSep xs)</tt> concatenates documents <tt>xs</tt>
--   horizontally with <tt>(<a>&lt;+&gt;</a>)</tt> as long as its fits the
--   page, than inserts a <a>line</a> and continues doing that for all
--   documents in <tt>xs</tt>.
--   
--   <pre>
--   fillSep xs = foldr (&lt;&gt; softline &lt;&gt;) mempty xs
--   </pre>
fillSep :: [StyleDoc] -> StyleDoc

-- | The document <tt>(sep xs)</tt> concatenates all documents <tt>xs</tt>
--   either horizontally with <tt>(&lt;+&gt;)</tt>, if it fits the page, or
--   vertically with <tt>(&lt;&gt; line &lt;&gt;)</tt>.
--   
--   <pre>
--   sep xs = group (vsep xs)
--   </pre>
sep :: [StyleDoc] -> StyleDoc

-- | The document <tt>(hcat xs)</tt> concatenates all documents <tt>xs</tt>
--   horizontally with <tt>(&lt;&gt;)</tt>.
hcat :: [StyleDoc] -> StyleDoc

-- | The document <tt>(vcat xs)</tt> concatenates all documents <tt>xs</tt>
--   vertically with <tt>(&lt;&gt; linebreak &lt;&gt;)</tt>. If a
--   <a>group</a> undoes the line breaks inserted by <a>vcat</a>, all
--   documents are directly concatenated.
vcat :: [StyleDoc] -> StyleDoc

-- | The document <tt>(fillCat xs)</tt> concatenates documents <tt>xs</tt>
--   horizontally with <tt>(&lt;&gt;)</tt> as long as its fits the page,
--   than inserts a <tt>linebreak</tt> and continues doing that for all
--   documents in <tt>xs</tt>.
--   
--   <pre>
--   fillCat xs = foldr (&lt;&gt; softbreak &lt;&gt;) mempty xs
--   </pre>
fillCat :: [StyleDoc] -> StyleDoc

-- | The document <tt>(cat xs)</tt> concatenates all documents <tt>xs</tt>
--   either horizontally with <tt>(&lt;&gt;)</tt>, if it fits the page, or
--   vertically with <tt>(&lt;&gt; linebreak &lt;&gt;)</tt>.
--   
--   <pre>
--   cat xs = group (vcat xs)
--   </pre>
cat :: [StyleDoc] -> StyleDoc

-- | <tt>(punctuate p xs)</tt> concatenates all documents in <tt>xs</tt>
--   with document <tt>p</tt> except for the last document.
--   
--   <pre>
--   someText = map fromString ["words", "in", "a", "tuple"]
--   test = parens (align (cat (punctuate comma someText)))
--   </pre>
--   
--   This is layed out on a page width of 20 as:
--   
--   <pre>
--   (words,in,a,tuple)
--   </pre>
--   
--   But when the page width is 15, it is layed out as:
--   
--   <pre>
--   (words,
--    in,
--    a,
--    tuple)
--   </pre>
--   
--   (If you want put the commas in front of their elements instead of at
--   the end, you should use <a>encloseSep</a>.)
punctuate :: StyleDoc -> [StyleDoc] -> [StyleDoc]

-- | The document <tt>(fill i x)</tt> renders document <tt>x</tt>. It than
--   appends <tt>(fromString " ")</tt>s until the width is equal to
--   <tt>i</tt>. If the width of <tt>x</tt> is already larger, nothing is
--   appended. This combinator is quite useful in practice to output a list
--   of bindings. The following example demonstrates this.
--   
--   <pre>
--   types = [ ("empty", "Doc a")
--           , ("nest", "Int -&gt; Doc a -&gt; Doc a")
--           , ("linebreak", "Doc a")
--           ]
--   
--   ptype (name, tp) =
--     fill 6 (fromString name) &lt;+&gt; fromString "::" &lt;+&gt; fromString tp
--   
--   test = fromString "let" &lt;+&gt; align (vcat (map ptype types))
--   </pre>
--   
--   Which is layed out as:
--   
--   <pre>
--   let empty  :: Doc a
--       nest   :: Int -&gt; Doc a -&gt; Doc a
--       linebreak :: Doc a
--   </pre>
fill :: Int -> StyleDoc -> StyleDoc

-- | The document <tt>(fillBreak i x)</tt> first renders document
--   <tt>x</tt>. It then appends <tt>(fromString " ")</tt>s until the width
--   is equal to <tt>i</tt>. If the width of <tt>x</tt> is already larger
--   than <tt>i</tt>, the nesting level is increased by <tt>i</tt> and a
--   <tt>line</tt> is appended. When we redefine <tt>ptype</tt> in the
--   previous example to use <tt>fillBreak</tt>, we get a useful variation
--   of the previous output:
--   
--   <pre>
--   ptype (name, tp) =
--     fillBreak 6 (fromString name) &lt;+&gt; fromString "::" &lt;+&gt; fromString tp
--   </pre>
--   
--   The output will now be:
--   
--   <pre>
--   let empty  :: Doc a
--       nest   :: Int -&gt; Doc a -&gt; Doc a
--       linebreak
--              :: Doc a
--   </pre>
fillBreak :: Int -> StyleDoc -> StyleDoc

-- | The document <tt>(enclose l r x)</tt> encloses document <tt>x</tt>
--   between documents <tt>l</tt> and <tt>r</tt> using <tt>(&lt;&gt;)</tt>.
--   
--   <pre>
--   enclose l r x   = l &lt;&gt; x &lt;&gt; r
--   </pre>
enclose :: StyleDoc -> StyleDoc -> StyleDoc -> StyleDoc

-- | Document <tt>(squotes x)</tt> encloses document <tt>x</tt> with single
--   quotes "'".
squotes :: StyleDoc -> StyleDoc

-- | Document <tt>(dquotes x)</tt> encloses document <tt>x</tt> with double
--   quotes '"'.
dquotes :: StyleDoc -> StyleDoc

-- | Document <tt>(parens x)</tt> encloses document <tt>x</tt> in
--   parenthesis, "(" and ")".
parens :: StyleDoc -> StyleDoc

-- | Document <tt>(angles x)</tt> encloses document <tt>x</tt> in angles,
--   "&lt;" and "&gt;".
angles :: StyleDoc -> StyleDoc

-- | Document <tt>(braces x)</tt> encloses document <tt>x</tt> in braces,
--   "{" and "}".
braces :: StyleDoc -> StyleDoc

-- | Document <tt>(brackets x)</tt> encloses document <tt>x</tt> in square
--   brackets, "[" and "]".
brackets :: StyleDoc -> StyleDoc

-- | The document <tt>string s</tt> concatenates all characters in
--   <tt>s</tt> using <tt>line</tt> for newline characters and
--   <tt>fromString</tt> for all other characters. It is used whenever the
--   text contains newline characters.
string :: String -> StyleDoc

-- | Use after a label and before the rest of what's being labelled for
--   consistent spacing<i>indenting</i>etc.
--   
--   For example this is used after "Warning:" in warning messages.
indentAfterLabel :: StyleDoc -> StyleDoc

-- | Make a <a>StyleDoc</a> from each word in a <a>String</a>
wordDocs :: String -> [StyleDoc]

-- | Wordwrap a <a>String</a>
flow :: String -> StyleDoc

-- | Type representing styles of output.
data Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the <tt>Error:</tt> or <tt>[error]</tt> label for an
--   error message, not the entire message.
Error :: Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the <tt>Warning:</tt> or <tt>[warn]</tt> label for a
--   warning message, not the entire message.
Warning :: Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the <tt>[info]</tt> label for an info message, not
--   the entire message.
Info :: Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the <tt>[debug]</tt> label for a debug message, not
--   the entire message.
Debug :: Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the <tt>[...]</tt> label for an other log level
--   message, not the entire message.
OtherLevel :: Style

-- | Style in a way to emphasize that it is a particularly good thing.
Good :: Style

-- | Style as a shell command, i.e. when suggesting something to the user
--   that should be typed in directly as written.
Shell :: Style

-- | Style as a filename. See <a>Dir</a> for directories.
File :: Style

-- | Style as a URL.
Url :: Style

-- | Style as a directory name. See <a>File</a> for files.
Dir :: Style

-- | Style used to highlight part of a recommended course of action.
Recommendation :: Style

-- | Style in a way that emphasizes that it is related to a current thing.
--   For example, to report the current package that is being processed
--   when outputting the name of it.
Current :: Style

-- | Style used the highlight the target of a course of action.
Target :: Style

-- | Style as a module name.
Module :: Style

-- | Style used to highlight the named component of a package.
PkgComponent :: Style

-- | Style for secondary content. For example, to style timestamps.
Secondary :: Style

-- | Intended to be used sparingly, not to style entire long messages. For
--   example, to style the duration in a <tt>Finished process in ...
--   ms</tt> message.
Highlight :: Style


-- | This module exports a <a>SimplePrettyApp</a> type, for providing a
--   basic environment including pretty printing functionality.
module RIO.PrettyPrint.Simple

-- | A simple, non-customizable environment type, which provides pretty
--   printing functionality.
data SimplePrettyApp

-- | Constructor for <a>SimplePrettyApp</a>. If <a>ProcessContext</a> is
--   not supplied <a>mkDefaultProcessContext</a> will be used to create it.
mkSimplePrettyApp :: MonadIO m => LogFunc -> Maybe ProcessContext -> Bool -> Int -> StylesUpdate -> m SimplePrettyApp

-- | Run with a default configured <tt>SimplePrettyApp</tt>, consisting of:
--   
--   <ul>
--   <li>Logging to <a>stderr</a></li>
--   <li>If the <tt>RIO_VERBOSE</tt> environment variable is set, turns on
--   verbose logging</li>
--   <li>Default process context</li>
--   <li>Logging using color</li>
--   </ul>
runSimplePrettyApp :: MonadIO m => Int -> StylesUpdate -> RIO SimplePrettyApp a -> m a
instance RIO.Prelude.Logger.HasLogFunc RIO.PrettyPrint.Simple.SimplePrettyApp
instance RIO.Process.HasProcessContext RIO.PrettyPrint.Simple.SimplePrettyApp
instance RIO.PrettyPrint.StylesUpdate.HasStylesUpdate RIO.PrettyPrint.Simple.SimplePrettyApp
instance RIO.PrettyPrint.HasTerm RIO.PrettyPrint.Simple.SimplePrettyApp
