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


-- | <b>Warning:</b> Internal module. May change arbitrarily between
--   versions.
module Data.Text.Prettyprint.Doc.Render.Terminal.Internal

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

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

-- | Foreground (text) or background (paper) color
data Layer
Foreground :: Layer
Background :: Layer
data Bold
Bold :: Bold
data Underlined
Underlined :: Underlined
data Italicized
Italicized :: Italicized

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

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

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

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

-- | Render in <b>bold</b>.
bold :: AnsiStyle

-- | Render in <i>italics</i>.
italicized :: AnsiStyle

-- | Render underlined.
underlined :: AnsiStyle

-- | <tt>(<a>renderLazy</a> doc)</tt> takes the output <tt>doc</tt> 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:
--   
--   <pre>
--   &gt;&gt;&gt; let render = TL.putStrLn . TL.replace "\ESC" "\\e" . renderLazy . layoutPretty defaultLayoutOptions
--   
--   &gt;&gt;&gt; let doc = annotate (color Red) ("red" &lt;+&gt; align (vsep [annotate (color Blue &lt;&gt; underlined) ("blue+u" &lt;+&gt; annotate bold "bold" &lt;+&gt; "blue+u"), "red"]))
--   
--   &gt;&gt;&gt; render (unAnnotate doc)
--   red blue+u bold blue+u
--       red
--   
--   &gt;&gt;&gt; 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
--   </pre>
--   
--   Run the above via <tt>echo -e <tt>...</tt></tt> in your terminal to
--   see the coloring.
renderLazy :: SimpleDocStream AnsiStyle -> Text

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

-- | 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.
--   
--   <pre>
--   style = <a>color</a> <a>Green</a> <a>&lt;&gt;</a> <a>bold</a>
--   styledDoc = <a>annotate</a> style "hello world"
--   </pre>
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
styleToRawText :: AnsiStyle -> Text

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

-- | <tt>(<a>putDoc</a> doc)</tt> prettyprints document <tt>doc</tt> to
--   standard output using <a>defaultLayoutOptions</a>.
--   
--   <pre>
--   &gt;&gt;&gt; putDoc ("hello" &lt;+&gt; "world")
--   hello world
--   </pre>
--   
--   <pre>
--   <a>putDoc</a> = <a>hPutDoc</a> <a>stdout</a>
--   </pre>
putDoc :: Doc AnsiStyle -> IO ()

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


-- | Render <tt>SimpleDocStream</tt> in a terminal.
module Data.Text.Prettyprint.Doc.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.
--   
--   <pre>
--   style = <a>color</a> <a>Green</a> <a>&lt;&gt;</a> <a>bold</a>
--   styledDoc = <a>annotate</a> style "hello world"
--   </pre>
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 <b>bold</b>.
bold :: AnsiStyle

-- | Render in <i>italics</i>.
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

-- | <tt>(<a>renderLazy</a> doc)</tt> takes the output <tt>doc</tt> 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:
--   
--   <pre>
--   &gt;&gt;&gt; let render = TL.putStrLn . TL.replace "\ESC" "\\e" . renderLazy . layoutPretty defaultLayoutOptions
--   
--   &gt;&gt;&gt; let doc = annotate (color Red) ("red" &lt;+&gt; align (vsep [annotate (color Blue &lt;&gt; underlined) ("blue+u" &lt;+&gt; annotate bold "bold" &lt;+&gt; "blue+u"), "red"]))
--   
--   &gt;&gt;&gt; render (unAnnotate doc)
--   red blue+u bold blue+u
--       red
--   
--   &gt;&gt;&gt; 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
--   </pre>
--   
--   Run the above via <tt>echo -e <tt>...</tt></tt> in your terminal to
--   see the coloring.
renderLazy :: SimpleDocStream AnsiStyle -> Text

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

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

-- | <tt>(<a>putDoc</a> doc)</tt> prettyprints document <tt>doc</tt> to
--   standard output using <a>defaultLayoutOptions</a>.
--   
--   <pre>
--   &gt;&gt;&gt; putDoc ("hello" &lt;+&gt; "world")
--   hello world
--   </pre>
--   
--   <pre>
--   <a>putDoc</a> = <a>hPutDoc</a> <a>stdout</a>
--   </pre>
putDoc :: Doc AnsiStyle -> IO ()

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