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

-- | ANSI terminal backend for the »prettyprinter« package.
--   
--   See README.md
@package prettyprinter-ansi-terminal
@version 1.1.3

-- | Warning: Internal module. May change arbitrarily between
--   versions.
module Prettyprinter.Render.Terminal.Internal

-- | Render the annotated document in a certain style. Styles not set in
--   the annotation will use the style of the surrounding document, or the
--   terminal’s default if none has been set yet.
--   
--   
--   style = color Green <> bold
--   styledDoc = annotate style "hello world"
--   
data AnsiStyle
SetAnsiStyle :: Maybe (Intensity, Color) -> Maybe (Intensity, Color) -> Maybe Bold -> Maybe Italicized -> Maybe Underlined -> AnsiStyle

-- | Set the foreground color, or keep the old one.
[ansiForeground] :: AnsiStyle -> Maybe (Intensity, Color)

-- | Set the background color, or keep the old one.
[ansiBackground] :: AnsiStyle -> Maybe (Intensity, Color)

-- | Switch on boldness, or don’t do anything.
[ansiBold] :: AnsiStyle -> Maybe Bold

-- | Switch on italics, or don’t do anything.
[ansiItalics] :: AnsiStyle -> Maybe Italicized

-- | Switch on underlining, or don’t do anything.
[ansiUnderlining] :: AnsiStyle -> Maybe Underlined

-- | The 8 ANSI terminal colors.
data Color
Black :: Color
Red :: Color
Green :: Color
Yellow :: Color
Blue :: Color
Magenta :: Color
Cyan :: Color
White :: Color

-- | Style the foreground with a vivid color.
color :: Color -> AnsiStyle

-- | Style the foreground with a dull color.
colorDull :: Color -> AnsiStyle

-- | Style the background with a vivid color.
bgColor :: Color -> AnsiStyle

-- | Style the background with a dull color.
bgColorDull :: Color -> AnsiStyle

-- | Render in bold.
bold :: AnsiStyle

-- | Render in italics.
italicized :: AnsiStyle

-- | Render underlined.
underlined :: AnsiStyle

-- | Dull or vivid coloring, as supported by ANSI terminals.
data Intensity
Vivid :: Intensity
Dull :: Intensity
data Bold
Bold :: Bold
data Underlined
Underlined :: Underlined
data Italicized
Italicized :: Italicized

-- | (renderLazy doc) takes the output doc from a
--   rendering function and transforms it to lazy text, including ANSI
--   styling directives for things like colorization.
--   
--   ANSI color information will be discarded by this function unless you
--   are running on a Unix-like operating system. This is due to a
--   technical limitation in Windows ANSI support.
--   
--   With a bit of trickery to make the ANSI codes printable, here is an
--   example that would render colored in an ANSI terminal:
--   
--   
--   >>> let render = TL.putStrLn . TL.replace "\ESC" "\\e" . renderLazy . layoutPretty defaultLayoutOptions
--   
--   >>> let doc = annotate (color Red) ("red" <+> align (vsep [annotate (color Blue <> underlined) ("blue+u" <+> annotate bold "bold" <+> "blue+u"), "red"]))
--   
--   >>> render (unAnnotate doc)
--   red blue+u bold blue+u
--       red
--   
--   >>> render doc
--   \e[0;91mred \e[0;94;4mblue+u \e[0;94;1;4mbold\e[0;94;4m blue+u\e[0;91m
--       red\e[0m
--   
--   
--   Run the above via echo -e ... in your terminal to
--   see the coloring.
renderLazy :: SimpleDocStream AnsiStyle -> Text

-- | (renderStrict sdoc) takes the output sdoc
--   from a rendering and transforms it to strict text.
renderStrict :: SimpleDocStream AnsiStyle -> Text

-- | (renderIO h sdoc) writes sdoc to the handle
--   h.
--   
--   
--   >>> let render = renderIO System.IO.stdout . layoutPretty defaultLayoutOptions
--   
--   >>> let doc = annotate (color Red) ("red" <+> align (vsep [annotate (color Blue <> underlined) ("blue+u" <+> annotate bold "bold" <+> "blue+u"), "red"]))
--   
--   
--   We render the unAnnotated version here, since the ANSI codes
--   don’t display well in Haddock,
--   
--   
--   >>> render (unAnnotate doc)
--   red blue+u bold blue+u
--       red
--   
--   
--   This function behaves just like
--   
--   
--   renderIO h sdoc = hPutStr h (renderLazy sdoc)
--   
--   
--   but will not generate any intermediate text, rendering directly to the
--   handle.
renderIO :: Handle -> SimpleDocStream AnsiStyle -> IO ()

-- | (putDoc doc) prettyprints document doc to
--   standard output using defaultLayoutOptions.
--   
--   
--   >>> putDoc ("hello" <+> "world")
--   hello world
--   
--   
--   
--   putDoc = hPutDoc stdout
--   
putDoc :: Doc AnsiStyle -> IO ()

-- | Like putDoc, but instead of using stdout, print to a
--   user-provided handle, e.g. a file or a socket using
--   defaultLayoutOptions.
--   
--   
--   main = withFile "someFile.txt" (\h -> hPutDoc h (vcat ["vertical", "text"]))
--   
--   
--   
--   hPutDoc h doc = renderIO h (layoutPretty defaultLayoutOptions doc)
--   
hPutDoc :: Handle -> Doc AnsiStyle -> IO ()
instance GHC.Classes.Eq Prettyprinter.Render.Terminal.Internal.AnsiStyle
instance GHC.Classes.Eq Prettyprinter.Render.Terminal.Internal.Bold
instance GHC.Classes.Eq Prettyprinter.Render.Terminal.Internal.Color
instance GHC.Classes.Eq Prettyprinter.Render.Terminal.Internal.Intensity
instance GHC.Classes.Eq Prettyprinter.Render.Terminal.Internal.Italicized
instance GHC.Classes.Eq Prettyprinter.Render.Terminal.Internal.Layer
instance GHC.Classes.Eq Prettyprinter.Render.Terminal.Internal.Underlined
instance GHC.Internal.Base.Monoid Prettyprinter.Render.Terminal.Internal.AnsiStyle
instance GHC.Classes.Ord Prettyprinter.Render.Terminal.Internal.AnsiStyle
instance GHC.Classes.Ord Prettyprinter.Render.Terminal.Internal.Bold
instance GHC.Classes.Ord Prettyprinter.Render.Terminal.Internal.Color
instance GHC.Classes.Ord Prettyprinter.Render.Terminal.Internal.Intensity
instance GHC.Classes.Ord Prettyprinter.Render.Terminal.Internal.Italicized
instance GHC.Classes.Ord Prettyprinter.Render.Terminal.Internal.Layer
instance GHC.Classes.Ord Prettyprinter.Render.Terminal.Internal.Underlined
instance GHC.Internal.Base.Semigroup Prettyprinter.Render.Terminal.Internal.AnsiStyle
instance GHC.Internal.Show.Show Prettyprinter.Render.Terminal.Internal.AnsiStyle
instance GHC.Internal.Show.Show Prettyprinter.Render.Terminal.Internal.Bold
instance GHC.Internal.Show.Show Prettyprinter.Render.Terminal.Internal.Color
instance GHC.Internal.Show.Show Prettyprinter.Render.Terminal.Internal.Intensity
instance GHC.Internal.Show.Show Prettyprinter.Render.Terminal.Internal.Italicized
instance GHC.Internal.Show.Show Prettyprinter.Render.Terminal.Internal.Layer
instance GHC.Internal.Show.Show Prettyprinter.Render.Terminal.Internal.Underlined

-- | Render SimpleDocStream in a terminal.
module Prettyprinter.Render.Terminal

-- | Render the annotated document in a certain style. Styles not set in
--   the annotation will use the style of the surrounding document, or the
--   terminal’s default if none has been set yet.
--   
--   
--   style = color Green <> bold
--   styledDoc = annotate style "hello world"
--   
data AnsiStyle

-- | The 8 ANSI terminal colors.
data Color
Black :: Color
Red :: Color
Green :: Color
Yellow :: Color
Blue :: Color
Magenta :: Color
Cyan :: Color
White :: Color

-- | Style the foreground with a vivid color.
color :: Color -> AnsiStyle

-- | Style the foreground with a dull color.
colorDull :: Color -> AnsiStyle

-- | Style the background with a vivid color.
bgColor :: Color -> AnsiStyle

-- | Style the background with a dull color.
bgColorDull :: Color -> AnsiStyle

-- | Render in bold.
bold :: AnsiStyle

-- | Render in italics.
italicized :: AnsiStyle

-- | Render underlined.
underlined :: AnsiStyle

-- | Dull or vivid coloring, as supported by ANSI terminals.
data Intensity
Vivid :: Intensity
Dull :: Intensity
data Bold
Bold :: Bold
data Underlined
Underlined :: Underlined
data Italicized
Italicized :: Italicized

-- | (renderLazy doc) takes the output doc from a
--   rendering function and transforms it to lazy text, including ANSI
--   styling directives for things like colorization.
--   
--   ANSI color information will be discarded by this function unless you
--   are running on a Unix-like operating system. This is due to a
--   technical limitation in Windows ANSI support.
--   
--   With a bit of trickery to make the ANSI codes printable, here is an
--   example that would render colored in an ANSI terminal:
--   
--   
--   >>> let render = TL.putStrLn . TL.replace "\ESC" "\\e" . renderLazy . layoutPretty defaultLayoutOptions
--   
--   >>> let doc = annotate (color Red) ("red" <+> align (vsep [annotate (color Blue <> underlined) ("blue+u" <+> annotate bold "bold" <+> "blue+u"), "red"]))
--   
--   >>> render (unAnnotate doc)
--   red blue+u bold blue+u
--       red
--   
--   >>> render doc
--   \e[0;91mred \e[0;94;4mblue+u \e[0;94;1;4mbold\e[0;94;4m blue+u\e[0;91m
--       red\e[0m
--   
--   
--   Run the above via echo -e ... in your terminal to
--   see the coloring.
renderLazy :: SimpleDocStream AnsiStyle -> Text

-- | (renderStrict sdoc) takes the output sdoc
--   from a rendering and transforms it to strict text.
renderStrict :: SimpleDocStream AnsiStyle -> Text

-- | (renderIO h sdoc) writes sdoc to the handle
--   h.
--   
--   
--   >>> let render = renderIO System.IO.stdout . layoutPretty defaultLayoutOptions
--   
--   >>> let doc = annotate (color Red) ("red" <+> align (vsep [annotate (color Blue <> underlined) ("blue+u" <+> annotate bold "bold" <+> "blue+u"), "red"]))
--   
--   
--   We render the unAnnotated version here, since the ANSI codes
--   don’t display well in Haddock,
--   
--   
--   >>> render (unAnnotate doc)
--   red blue+u bold blue+u
--       red
--   
--   
--   This function behaves just like
--   
--   
--   renderIO h sdoc = hPutStr h (renderLazy sdoc)
--   
--   
--   but will not generate any intermediate text, rendering directly to the
--   handle.
renderIO :: Handle -> SimpleDocStream AnsiStyle -> IO ()

-- | (putDoc doc) prettyprints document doc to
--   standard output using defaultLayoutOptions.
--   
--   
--   >>> putDoc ("hello" <+> "world")
--   hello world
--   
--   
--   
--   putDoc = hPutDoc stdout
--   
putDoc :: Doc AnsiStyle -> IO ()

-- | Like putDoc, but instead of using stdout, print to a
--   user-provided handle, e.g. a file or a socket using
--   defaultLayoutOptions.
--   
--   
--   main = withFile "someFile.txt" (\h -> hPutDoc h (vcat ["vertical", "text"]))
--   
--   
--   
--   hPutDoc h doc = renderIO h (layoutPretty defaultLayoutOptions doc)
--   
hPutDoc :: Handle -> Doc AnsiStyle -> IO ()

-- | Deprecated: Use Prettyprinter.Render.Terminal instead.
module Data.Text.Prettyprint.Doc.Render.Terminal

-- | Deprecated: Use Prettyprinter.Render.Terminal.Internal
--   instead.
module Data.Text.Prettyprint.Doc.Render.Terminal.Internal
