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


-- | Styled console text output using ANSI escape sequences.
--   
--   Styled console text output using ANSI escape sequences.
@package colorful-monoids
@version 0.2.1.0


-- | This module provides the flat <a>Colored</a> type, which is used
--   internally for rendering the nested <a>Colored</a> but is also useful
--   on its own. The API resembles the API of <a>Colorful</a>.
module Data.Monoid.Colorful.Flat
data Colored a
Value :: a -> Colored a
Style :: !Style -> Colored a
Unstyle :: !Style -> Colored a
Fg :: !Color -> Colored a
Bg :: !Color -> Colored a
Push :: Colored a
Pop :: Colored a
Reset :: Colored a

-- | Rendering style
data Style

-- | Bold font
Bold :: Style

-- | Italic font
Italic :: Style

-- | Underlined text
Underline :: Style

-- | Invert foreground and background color
Invert :: Style

-- | Blinking
Blink :: Style

-- | Named colors, 256 and RGB colors for more capable terminals.
data Color

-- | Default terminal color (terminal specific)
DefaultColor :: Color
Black :: Color
Red :: Color
Green :: Color
Yellow :: Color
Blue :: Color
Magenta :: Color
Cyan :: Color
White :: Color
DullBlack :: Color
DullRed :: Color
DullGreen :: Color
DullYellow :: Color
DullBlue :: Color
DullMagenta :: Color
DullCyan :: Color
DullWhite :: Color

-- | Color from 256 color scheme. Color is automatically reduced to 8
--   colors for less capable terminals.
Color256 :: !Word8 -> Color

-- | True color. Color is automatically reduced to 256 or 8 colors for less
--   capable terminals.
RGB :: !Word8 -> !Word8 -> !Word8 -> Color

-- | Terminal type. For less capable terminals the color depth is
--   automatically reduced.
data Term

-- | Dumb terminal - no color output
TermDumb :: Term

-- | 8 colors supported
Term8 :: Term

-- | 256 colors supported
Term256 :: Term

-- | True colors supported
TermRGB :: Term

-- | Windows terminal. Will use emulation (Not yet implemented).
TermWin :: Term

-- | The action <tt>(hGetTerm handle)</tt> determines the terminal type of
--   the file <tt>handle</tt>.
--   
--   The terminal type is determined by checking if the file handle points
--   to a device and by looking at the <tt>$TERM</tt> environment variable.
hGetTerm :: Handle -> IO Term
getTerm :: IO Term
hPrintColored :: Foldable f => (Handle -> a -> IO ()) -> Handle -> Term -> f (Colored a) -> IO ()
printColored :: Foldable f => (a -> IO ()) -> Term -> f (Colored a) -> IO ()
hPrintColoredIO :: Handle -> Term -> [Colored (IO ())] -> IO ()
printColoredIO :: Term -> [Colored (IO ())] -> IO ()
hPrintColoredS :: Foldable f => Handle -> Term -> f (Colored String) -> IO ()
printColoredS :: Foldable f => Term -> f (Colored String) -> IO ()
showColored :: (Foldable f, Monoid o) => (a -> o) -> (SGRCode -> o) -> Term -> f (Colored a) -> o
showColoredM :: (Foldable f, Monad m, Monoid o) => (a -> m o) -> (SGRCode -> m o) -> Term -> f (Colored a) -> m o
showColoredS :: Foldable f => Term -> f (Colored String) -> ShowS

-- | An associative operation.
--   
--   <pre>
--   (a <a>&lt;&gt;</a> b) <a>&lt;&gt;</a> c = a <a>&lt;&gt;</a> (b <a>&lt;&gt;</a> c)
--   </pre>
--   
--   If <tt>a</tt> is also a <a>Monoid</a> we further require
--   
--   <pre>
--   (<a>&lt;&gt;</a>) = <a>mappend</a>
--   </pre>
(<>) :: Semigroup a => a -> a -> a
instance GHC.Generics.Generic1 Data.Monoid.Colorful.Flat.Colored
instance GHC.Generics.Generic (Data.Monoid.Colorful.Flat.Colored a)
instance Data.Traversable.Traversable Data.Monoid.Colorful.Flat.Colored
instance Data.Foldable.Foldable Data.Monoid.Colorful.Flat.Colored
instance GHC.Base.Functor Data.Monoid.Colorful.Flat.Colored
instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.Monoid.Colorful.Flat.Colored a)
instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.Monoid.Colorful.Flat.Colored a)
instance GHC.Show.Show a => GHC.Show.Show (Data.Monoid.Colorful.Flat.Colored a)


-- | This library provides styled text output using ANSI escape sequences.
--   The colored text is modeled as nested Colored values, which form a
--   Monoid. As a result the colored code has a relatively concise form.
--   
--   For rendering, the Colored Monoid is flattended and then printed out.
--   The library keeps track of a stack of the active styles internally,
--   such that correct and minimal escape sequences are generated.
--   
--   This library is used by <a>wl-pprint-console</a>, which is a pretty
--   printer with support for annotations.
--   
--   Warning: Windows support is currently not implemented, but is planned
--   (by using ansi-terminal or the ffi).
--   
--   Example:
--   
--   <pre>
--   basicExample :: IO ()
--   basicExample = do
--     term &lt;- getTerm
--     printColoredS term $ Style Underline (Style Bold "Basic Example\n")
--       &lt;&gt; Style Bold "Bold"
--       &lt;&gt; Style Italic (Bg Red "Italic Red")
--       &lt;&gt; Style Underline "Underline"
--     putChar '\n'
--   </pre>
--   
--   For many more examples, see the <a>example.hs</a> file.
module Data.Monoid.Colorful

-- | Colored Monoid
data Colored a
Nil :: Colored a
Value :: a -> Colored a
Style :: !Style -> (Colored a) -> Colored a
Unstyle :: !Style -> (Colored a) -> Colored a
Fg :: !Color -> (Colored a) -> Colored a
Bg :: !Color -> (Colored a) -> Colored a
Pair :: (Colored a) -> (Colored a) -> Colored a

-- | Rendering style
data Style

-- | Bold font
Bold :: Style

-- | Italic font
Italic :: Style

-- | Underlined text
Underline :: Style

-- | Invert foreground and background color
Invert :: Style

-- | Blinking
Blink :: Style

-- | Named colors, 256 and RGB colors for more capable terminals.
data Color

-- | Default terminal color (terminal specific)
DefaultColor :: Color
Black :: Color
Red :: Color
Green :: Color
Yellow :: Color
Blue :: Color
Magenta :: Color
Cyan :: Color
White :: Color
DullBlack :: Color
DullRed :: Color
DullGreen :: Color
DullYellow :: Color
DullBlue :: Color
DullMagenta :: Color
DullCyan :: Color
DullWhite :: Color

-- | Color from 256 color scheme. Color is automatically reduced to 8
--   colors for less capable terminals.
Color256 :: !Word8 -> Color

-- | True color. Color is automatically reduced to 256 or 8 colors for less
--   capable terminals.
RGB :: !Word8 -> !Word8 -> !Word8 -> Color

-- | Terminal type. For less capable terminals the color depth is
--   automatically reduced.
data Term

-- | Dumb terminal - no color output
TermDumb :: Term

-- | 8 colors supported
Term8 :: Term

-- | 256 colors supported
Term256 :: Term

-- | True colors supported
TermRGB :: Term

-- | Windows terminal. Will use emulation (Not yet implemented).
TermWin :: Term

-- | The action <tt>(hGetTerm handle)</tt> determines the terminal type of
--   the file <tt>handle</tt>.
--   
--   The terminal type is determined by checking if the file handle points
--   to a device and by looking at the <tt>$TERM</tt> environment variable.
hGetTerm :: Handle -> IO Term
getTerm :: IO Term
hPrintColored :: (Handle -> a -> IO ()) -> Handle -> Term -> Colored a -> IO ()
printColored :: (a -> IO ()) -> Term -> Colored a -> IO ()
hPrintColoredIO :: Handle -> Term -> Colored (IO ()) -> IO ()
printColoredIO :: Term -> Colored (IO ()) -> IO ()
hPrintColoredS :: Handle -> Term -> Colored String -> IO ()
printColoredS :: Term -> Colored String -> IO ()
showColored :: Monoid o => (a -> o) -> (SGRCode -> o) -> Term -> Colored a -> o
showColoredM :: (Monad f, Monoid o) => (a -> f o) -> (SGRCode -> f o) -> Term -> Colored a -> f o
showColoredS :: Term -> Colored String -> ShowS

-- | An associative operation.
--   
--   <pre>
--   (a <a>&lt;&gt;</a> b) <a>&lt;&gt;</a> c = a <a>&lt;&gt;</a> (b <a>&lt;&gt;</a> c)
--   </pre>
--   
--   If <tt>a</tt> is also a <a>Monoid</a> we further require
--   
--   <pre>
--   (<a>&lt;&gt;</a>) = <a>mappend</a>
--   </pre>
(<>) :: Semigroup a => a -> a -> a
