-- 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.4.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

-- | A style of rio-prettyprint's output.
data Style
Error :: Style
Warning :: Style
Info :: Style
Debug :: Style
OtherLevel :: Style
Good :: Style
Shell :: Style
File :: Style
Url :: Style
Dir :: Style
Recommendation :: Style
Current :: Style
Target :: Style
Module :: Style
PkgComponent :: Style
Secondary :: Style
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.Show.Show RIO.PrettyPrint.Types.Style
instance GHC.Classes.Ord RIO.PrettyPrint.Types.Style
instance GHC.Ix.Ix RIO.PrettyPrint.Types.Style
instance GHC.Classes.Eq RIO.PrettyPrint.Types.Style
instance GHC.Enum.Enum RIO.PrettyPrint.Types.Style
instance GHC.Enum.Bounded RIO.PrettyPrint.Types.Style
instance GHC.Base.Semigroup 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.Show.Show RIO.PrettyPrint.StylesUpdate.StylesUpdate
instance GHC.Classes.Eq RIO.PrettyPrint.StylesUpdate.StylesUpdate
instance RIO.PrettyPrint.StylesUpdate.HasStylesUpdate RIO.PrettyPrint.StylesUpdate.StylesUpdate
instance GHC.Base.Semigroup RIO.PrettyPrint.StylesUpdate.StylesUpdate
instance GHC.Base.Monoid RIO.PrettyPrint.StylesUpdate.StylesUpdate
instance Data.Aeson.Types.FromJSON.FromJSON RIO.PrettyPrint.StylesUpdate.StylesUpdate


-- | This module re-exports some of the interface for
--   <a>Text.PrettyPrint.Annotated.Leijen</a> along with additional
--   definitions useful for stack.
--   
--   It defines a <a>Monoid</a> instance for <a>Doc</a>.
module Text.PrettyPrint.Leijen.Extended
class Pretty a
pretty :: Pretty a => a -> StyleDoc
pretty :: (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
nest :: Int -> StyleDoc -> StyleDoc
line :: StyleDoc
linebreak :: StyleDoc
group :: StyleDoc -> StyleDoc
softline :: StyleDoc
softbreak :: StyleDoc
align :: StyleDoc -> StyleDoc
hang :: Int -> StyleDoc -> StyleDoc
indent :: Int -> StyleDoc -> StyleDoc
encloseSep :: StyleDoc -> StyleDoc -> StyleDoc -> [StyleDoc] -> StyleDoc
(<+>) :: StyleDoc -> StyleDoc -> StyleDoc
hsep :: [StyleDoc] -> StyleDoc
vsep :: [StyleDoc] -> StyleDoc
fillSep :: [StyleDoc] -> StyleDoc
sep :: [StyleDoc] -> StyleDoc
hcat :: [StyleDoc] -> StyleDoc
vcat :: [StyleDoc] -> StyleDoc
fillCat :: [StyleDoc] -> StyleDoc
cat :: [StyleDoc] -> StyleDoc
punctuate :: StyleDoc -> [StyleDoc] -> [StyleDoc]
fill :: Int -> StyleDoc -> StyleDoc
fillBreak :: Int -> StyleDoc -> StyleDoc
enclose :: StyleDoc -> StyleDoc -> StyleDoc -> StyleDoc
squotes :: StyleDoc -> StyleDoc
dquotes :: StyleDoc -> StyleDoc
parens :: StyleDoc -> StyleDoc
angles :: StyleDoc -> StyleDoc
braces :: StyleDoc -> StyleDoc
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>char</tt> for all other characters. It is used whenever the text
--   contains newline characters.
string :: String -> StyleDoc
annotate :: StyleAnn -> StyleDoc -> StyleDoc
noAnnotate :: StyleDoc -> StyleDoc
styleAnn :: Style -> StyleDoc -> StyleDoc
instance GHC.Base.Semigroup Text.PrettyPrint.Leijen.Extended.StyleAnn
instance GHC.Show.Show Text.PrettyPrint.Leijen.Extended.StyleAnn
instance GHC.Classes.Eq Text.PrettyPrint.Leijen.Extended.StyleAnn
instance GHC.Show.Show Text.PrettyPrint.Leijen.Extended.StyleDoc
instance Data.String.IsString Text.PrettyPrint.Leijen.Extended.StyleDoc
instance GHC.Base.Monoid Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance GHC.Base.Semigroup Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance GHC.Show.Show Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance GHC.Classes.Eq Text.PrettyPrint.Leijen.Extended.AnsiAnn
instance GHC.Classes.Ord Text.PrettyPrint.Leijen.Extended.SGRTag
instance GHC.Classes.Eq Text.PrettyPrint.Leijen.Extended.SGRTag
instance Text.PrettyPrint.Leijen.Extended.Pretty Text.PrettyPrint.Leijen.Extended.StyleDoc
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 Distribution.ModuleName.ModuleName
instance GHC.Base.Semigroup Text.PrettyPrint.Leijen.Extended.StyleDoc
instance GHC.Base.Monoid Text.PrettyPrint.Leijen.Extended.StyleDoc
instance GHC.Base.Monoid Text.PrettyPrint.Leijen.Extended.StyleAnn


-- | 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
instance GHC.Show.Show RIO.PrettyPrint.PrettyException.PrettyException
instance Text.PrettyPrint.Leijen.Extended.Pretty RIO.PrettyPrint.PrettyException.PrettyException
instance GHC.Exception.Type.Exception 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 ()
prettyInfo :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyNote :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyWarn :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyError :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyWarnNoIndent :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyErrorNoIndent :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => StyleDoc -> m ()
prettyDebugL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyInfoL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyNoteL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyWarnL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyErrorL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyWarnNoIndentL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyErrorNoIndentL :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => [StyleDoc] -> m ()
prettyDebugS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyInfoS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyNoteS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyWarnS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyErrorS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyWarnNoIndentS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()
prettyErrorNoIndentS :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m) => String -> m ()

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

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

-- | Display a bulleted list of <a>StyleDoc</a>.
bulletedList :: [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]

-- | Display a bulleted list of <a>StyleDoc</a> with a blank line between
--   each.
spacedBulletedList :: [StyleDoc] -> StyleDoc
debugBracket :: (HasCallStack, HasTerm env, MonadReader env m, MonadIO m, MonadUnliftIO m) => StyleDoc -> m a -> m a
class Pretty a
pretty :: Pretty a => a -> StyleDoc
pretty :: (Pretty a, Show a) => a -> StyleDoc

-- | A document annotated by a style
data StyleDoc

-- | A style annotation.
newtype StyleAnn
StyleAnn :: Maybe Style -> StyleAnn
nest :: Int -> StyleDoc -> StyleDoc
line :: StyleDoc
linebreak :: StyleDoc
group :: StyleDoc -> StyleDoc
softline :: StyleDoc
softbreak :: StyleDoc
align :: StyleDoc -> StyleDoc
hang :: Int -> StyleDoc -> StyleDoc
indent :: Int -> StyleDoc -> StyleDoc
encloseSep :: StyleDoc -> StyleDoc -> StyleDoc -> [StyleDoc] -> StyleDoc
(<+>) :: StyleDoc -> StyleDoc -> StyleDoc
hsep :: [StyleDoc] -> StyleDoc
vsep :: [StyleDoc] -> StyleDoc
fillSep :: [StyleDoc] -> StyleDoc
sep :: [StyleDoc] -> StyleDoc
hcat :: [StyleDoc] -> StyleDoc
vcat :: [StyleDoc] -> StyleDoc
fillCat :: [StyleDoc] -> StyleDoc
cat :: [StyleDoc] -> StyleDoc
punctuate :: StyleDoc -> [StyleDoc] -> [StyleDoc]
fill :: Int -> StyleDoc -> StyleDoc
fillBreak :: Int -> StyleDoc -> StyleDoc
enclose :: StyleDoc -> StyleDoc -> StyleDoc -> StyleDoc
squotes :: StyleDoc -> StyleDoc
dquotes :: StyleDoc -> StyleDoc
parens :: StyleDoc -> StyleDoc
angles :: StyleDoc -> StyleDoc
braces :: StyleDoc -> StyleDoc
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>char</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 <tt>Doc</tt> from each word in a <a>String</a>
wordDocs :: String -> [StyleDoc]

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

-- | A style of rio-prettyprint's output.
data Style
Error :: Style
Warning :: Style
Info :: Style
Debug :: Style
OtherLevel :: Style
Good :: Style
Shell :: Style
File :: Style
Url :: Style
Dir :: Style
Recommendation :: Style
Current :: Style
Target :: Style
Module :: Style
PkgComponent :: Style
Secondary :: Style
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
