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


-- | Haskell bindings to the terminfo library.
°5u
°5uThis library provides an interface to the terminfo database (via
°5ubindings to the curses library). <a>Terminfo</a> allows POSIX systems
°5uto interact with a variety of terminals using a standard set of
°5ucapabilities.
@package terminfo
@version 0.4.1.1


-- | This module provides a low-level interface to the C functions of the
°5uterminfo library.
°5u
°5uNOTE: Since this library is built on top of the curses interface, it
°5uis not thread-safe.
module System.Console.Terminfo.Base
data Terminal

-- | Initialize the terminfo library to the given terminal entry.
°5u
°5uThrows a <a>SetupTermError</a> if the terminfo database could not be
°5uread.
setupTerm :: String -> IO Terminal

-- | Initialize the terminfo library, using the <tt>TERM</tt> environmental
°5uvariable. If <tt>TERM</tt> is not set, we use the generic, minimal
°5uentry <tt>dumb</tt>.
°5u
°5uThrows a <a>SetupTermError</a> if the terminfo database could not be
°5uread.
setupTermFromEnv :: IO Terminal
data SetupTermError

-- | A feature or operation which a <a>Terminal</a> may define.
data Capability a
getCapability :: Terminal -> Capability a -> Maybe a

-- | Look up a boolean capability in the terminfo database.
°5u
°5uUnlike <a>tiGuardFlag</a>, this capability never fails; it returns
°5u<a>False</a> if the capability is absent or set to false, and returns
°5u<a>True</a> otherwise.
tiGetFlag :: String -> Capability Bool

-- | Look up a boolean capability in the terminfo database, and fail if
°5uit's not defined.
tiGuardFlag :: String -> Capability ()

-- | Look up a numeric capability in the terminfo database.
tiGetNum :: String -> Capability Int

-- | Look up a string capability in the terminfo database. NOTE: This
°5ufunction is deprecated; use <a>tiGetOutput1</a> instead.

-- | <i>Deprecated: use tiGetOutput instead.</i>
tiGetStr :: String -> Capability String

-- | Look up an output capability which takes a fixed number of parameters
°5u(for example, <tt>Int -&gt; Int -&gt; TermOutput</tt>).
°5u
°5uFor capabilities which may contain variable-length padding, use
°5u<a>tiGetOutput</a> instead.
tiGetOutput1 :: forall f. OutputCap f => String -> Capability f
class OutputCap f
class (Monoid s, OutputCap s) => TermStr s

-- | An action which sends output to the terminal. That output may mix
°5uplain text with control characters and escape sequences, along with
°5udelays (called "padding") required by some older terminals.
data TermOutput

-- | Write the terminal output to the standard output device.
runTermOutput :: Terminal -> TermOutput -> IO ()

-- | Write the terminal output to the terminal or file managed by the given
°5u<a>Handle</a>.
hRunTermOutput :: Handle -> Terminal -> TermOutput -> IO ()
termText :: String -> TermOutput

-- | Look up an output capability in the terminfo database.
tiGetOutput :: String -> Capability ([Int] -> LinesAffected -> TermOutput)

-- | A parameter to specify the number of lines affected. Some capabilities
°5u(e.g., <tt>clear</tt> and <tt>dch1</tt>) use this parameter on some
°5uterminals to compute variable-length padding.
type LinesAffected = Int

-- | The class of monoids (types with an associative binary operation that
°5uhas an identity). Instances should satisfy the following laws:
°5u
°5u<ul>
°5u<li><pre>x <a>&lt;&gt;</a> <a>mempty</a> = x</pre></li>
°5u<li><pre><a>mempty</a> <a>&lt;&gt;</a> x = x</pre></li>
°5u<li><tt>x <a>&lt;&gt;</a> (y <a>&lt;&gt;</a> z) = (x <a>&lt;&gt;</a>
°5uy) <a>&lt;&gt;</a> z</tt> (<a>Semigroup</a> law)</li>
°5u<li><pre><a>mconcat</a> = <a>foldr</a> '(&lt;&gt;)'
°5u<a>mempty</a></pre></li>
°5u</ul>
°5u
°5uThe method names refer to the monoid of lists under concatenation, but
°5uthere are many other instances.
°5u
°5uSome types can be viewed as a monoid in more than one way, e.g. both
°5uaddition and multiplication on numbers. In such cases we often define
°5u<tt>newtype</tt>s and make those instances of <a>Monoid</a>, e.g.
°5u<tt>Sum</tt> and <tt>Product</tt>.
°5u
°5u<b>NOTE</b>: <a>Semigroup</a> is a superclass of <a>Monoid</a> since
°5u<i>base-4.11.0.0</i>.
class Semigroup a => Monoid a

-- | Identity of <a>mappend</a>
mempty :: Monoid a => a

-- | An associative operation
°5u
°5u<b>NOTE</b>: This method is redundant and has the default
°5uimplementation <tt><a>mappend</a> = '(&lt;&gt;)'</tt> since
°5u<i>base-4.11.0.0</i>.
mappend :: Monoid a => a -> a -> a

-- | Fold a list using the monoid.
°5u
°5uFor most types, the default definition for <a>mconcat</a> will be
°5uused, but the function is included in the class definition so that an
°5uoptimized version can be provided for specific types.
mconcat :: Monoid a => [a] -> a

-- | An operator version of <a>mappend</a>.
(<#>) :: Monoid m => m -> m -> m
infixl 2 <#>
instance System.Console.Terminfo.Base.TermStr [GHC.Types.Char]
instance System.Console.Terminfo.Base.TermStr System.Console.Terminfo.Base.TermOutput
instance System.Console.Terminfo.Base.OutputCap [GHC.Types.Char]
instance System.Console.Terminfo.Base.OutputCap System.Console.Terminfo.Base.TermOutput
instance (GHC.Enum.Enum p, System.Console.Terminfo.Base.OutputCap f) => System.Console.Terminfo.Base.OutputCap (p -> f)
instance GHC.Base.Semigroup System.Console.Terminfo.Base.TermOutput
instance GHC.Base.Monoid System.Console.Terminfo.Base.TermOutput
instance GHC.Base.Functor System.Console.Terminfo.Base.Capability
instance GHC.Base.Applicative System.Console.Terminfo.Base.Capability
instance GHC.Base.Monad System.Console.Terminfo.Base.Capability
instance GHC.Base.Alternative System.Console.Terminfo.Base.Capability
instance GHC.Base.MonadPlus System.Console.Terminfo.Base.Capability
instance GHC.Show.Show System.Console.Terminfo.Base.SetupTermError
instance GHC.Exception.Exception System.Console.Terminfo.Base.SetupTermError


module System.Console.Terminfo.Color

-- | The maximum number of of colors on the screen.
termColors :: Capability Int
data Color
Black :: Color
Red :: Color
Green :: Color
Yellow :: Color
Blue :: Color
Magenta :: Color
Cyan :: Color
White :: Color
ColorNumber :: Int -> Color

-- | This capability temporarily sets the terminal's foreground color while
°5uoutputting the given text, and then restores the terminal to its
°5udefault foreground and background colors.
withForegroundColor :: TermStr s => Capability (Color -> s -> s)

-- | This capability temporarily sets the terminal's background color while
°5uoutputting the given text, and then restores the terminal to its
°5udefault foreground and background colors.
withBackgroundColor :: TermStr s => Capability (Color -> s -> s)

-- | Sets the foreground color of all further text output, using either the
°5u<tt>setaf</tt> or <tt>setf</tt> capability.
setForegroundColor :: TermStr s => Capability (Color -> s)

-- | Sets the background color of all further text output, using either the
°5u<tt>setab</tt> or <tt>setb</tt> capability.
setBackgroundColor :: TermStr s => Capability (Color -> s)

-- | Restores foreground/background colors to their original settings.
restoreDefaultColors :: TermStr s => Capability s
instance GHC.Classes.Ord System.Console.Terminfo.Color.Color
instance GHC.Classes.Eq System.Console.Terminfo.Color.Color
instance GHC.Show.Show System.Console.Terminfo.Color.Color


-- | This module provides capabilities for moving the cursor on the
°5uterminal.
module System.Console.Terminfo.Cursor
termLines :: Capability Int
termColumns :: Capability Int

-- | This flag specifies that the cursor wraps automatically from the last
°5ucolumn of one line to the first column of the next.
autoRightMargin :: Capability Bool

-- | This flag specifies that a backspace at column 0 wraps the cursor to
°5uthe last column of the previous line.
autoLeftMargin :: Capability Bool

-- | This flag specifies that the terminal does not perform
°5u<a>autoRightMargin</a>-style wrapping when the character which would
°5ucause the wraparound is a control character. This is also known as the
°5u"newline glitch" or "magic wrap".
°5u
°5uFor example, in an 80-column terminal with this behavior, the
°5ufollowing will print single-spaced instead of double-spaced:
°5u
°5u<pre>
°5ureplicateM_ 5 $ putStr $ replicate 80 'x' ++ "\n"
°5u</pre>
wraparoundGlitch :: Capability Bool

-- | The <tt>cr</tt> capability, which moves the cursor to the first column
°5uof the current line.
carriageReturn :: TermStr s => Capability s

-- | The <tt>nel</tt> capability, which moves the cursor to the first
°5ucolumn of the next line. It behaves like a carriage return followed by
°5ua line feed.
°5u
°5uIf <tt>nel</tt> is not defined, this may be built out of other
°5ucapabilities.
newline :: TermStr s => Capability s
scrollForward :: TermStr s => Capability s
scrollReverse :: TermStr s => Capability s
moveDown :: TermStr s => Capability (Int -> s)
moveLeft :: TermStr s => Capability (Int -> s)
moveRight :: TermStr s => Capability (Int -> s)
moveUp :: TermStr s => Capability (Int -> s)
cursorDown1 :: TermStr s => Capability s
cursorLeft1 :: TermStr s => Capability s
cursorRight1 :: TermStr s => Capability s
cursorUp1 :: TermStr s => Capability s
cursorDown :: TermStr s => Capability (Int -> s)
cursorLeft :: TermStr s => Capability (Int -> s)
cursorRight :: TermStr s => Capability (Int -> s)
cursorUp :: TermStr s => Capability (Int -> s)
cursorHome :: TermStr s => Capability s
cursorToLL :: TermStr s => Capability s
cursorAddress :: TermStr s => Capability (Point -> s)
data Point
Point :: Int -> Point
[row, col] :: Point -> Int
rowAddress :: TermStr s => Capability (Int -> s)
columnAddress :: TermStr s => Capability (Int -> s)


module System.Console.Terminfo.Edit

-- | Clear the screen, and move the cursor to the upper left.
clearScreen :: Capability (LinesAffected -> TermOutput)

-- | Clear from beginning of line to cursor.
clearBOL :: TermStr s => Capability s

-- | Clear from cursor to end of line.
clearEOL :: TermStr s => Capability s

-- | Clear display after cursor.
clearEOS :: Capability (LinesAffected -> TermOutput)


module System.Console.Terminfo.Effects

-- | Sound the audible bell.
bell :: TermStr s => Capability s

-- | Present a visual alert using the <tt>flash</tt> capability.
visualBell :: Capability TermOutput
data Attributes
Attributes :: Bool -> Attributes
[standoutAttr, underlineAttr, reverseAttr, blinkAttr, dimAttr, boldAttr, invisibleAttr, protectedAttr] :: Attributes -> Bool

-- | These attributes have all properties turned off.
defaultAttributes :: Attributes

-- | Sets the attributes on or off before outputting the given text, and
°5uthen turns them all off. This capability will always succeed;
°5uproperties which cannot be set in the current terminal will be
°5uignored.
withAttributes :: TermStr s => Capability (Attributes -> s -> s)

-- | Sets the attributes on or off. This capability will always succeed;
°5uproperties which cannot be set in the current terminal will be
°5uignored.
setAttributes :: TermStr s => Capability (Attributes -> s)

-- | Turns off all text attributes. This capability will always succeed,
°5ubut it has no effect in terminals which do not support text
°5uattributes.
allAttributesOff :: TermStr s => Capability s

-- | Turns on standout mode before outputting the given text, and then
°5uturns it off.
withStandout :: TermStr s => Capability (s -> s)

-- | Turns on underline mode before outputting the given text, and then
°5uturns it off.
withUnderline :: TermStr s => Capability (s -> s)

-- | Turns on bold mode before outputting the given text, and then turns
°5uall attributes off.
withBold :: TermStr s => Capability (s -> s)
enterStandoutMode :: TermStr s => Capability s
exitStandoutMode :: TermStr s => Capability s
enterUnderlineMode :: TermStr s => Capability s
exitUnderlineMode :: TermStr s => Capability s
reverseOn :: TermStr s => Capability s
blinkOn :: TermStr s => Capability s
boldOn :: TermStr s => Capability s
dimOn :: TermStr s => Capability s
invisibleOn :: TermStr s => Capability s
protectedOn :: TermStr s => Capability s


-- | The string capabilities in this module are the character sequences
°5ucorresponding to user input such as arrow keys and function keys.
module System.Console.Terminfo.Keys
keypadOn :: TermStr s => Capability s
keypadOff :: TermStr s => Capability s
keyUp :: Capability String
keyDown :: Capability String
keyLeft :: Capability String
keyRight :: Capability String

-- | Look up the control sequence for a given function sequence. For
°5uexample, <tt>functionKey 12</tt> retrieves the <tt>kf12</tt>
°5ucapability.
functionKey :: Int -> Capability String
keyBackspace :: Capability String
keyDeleteChar :: Capability String
keyHome :: Capability String
keyEnd :: Capability String
keyPageUp :: Capability String
keyPageDown :: Capability String
keyEnter :: Capability String


module System.Console.Terminfo
