-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Haskell bindings to the terminfo library. -- -- This library provides an interface to the terminfo database (via -- bindings to the curses library). Terminfo allows programs to interact -- with a variety of terminals using a standard set of capabilities. @package terminfo @version 0.2.2 -- | This module provides a low-level interface to the C functions of the -- terminfo library. -- -- NOTE: Since this library is built on top of the curses interface, it -- is not thread-safe. module System.Console.Terminfo.Base data Terminal -- | Initialize the terminfo library to the given terminal entry. setupTerm :: String -> IO Terminal -- | Initialize the terminfo library, using the TERM environmental -- variable. If TERM is not set, we use the generic, minimal -- entry dumb. setupTermFromEnv :: IO Terminal -- | A feature or operation which a Terminal may define. data Capability a getCapability :: Terminal -> Capability a -> Maybe a -- | Look up a boolean capability in the terminfo database. -- -- Unlike tiGuardFlag, this capability never fails; it returns -- False if the capability is absent or set to false, and returns -- True otherwise. tiGetFlag :: String -> Capability Bool -- | Look up a boolean capability in the terminfo database, and fail if -- it'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: Do not use this function for terminal output; use -- tiGetOutput instead. tiGetStr :: String -> Capability String -- | An action which sends output to the terminal. That output may mix -- plain text with control characters and escape sequences, along with -- delays (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 -- Handle. hRunTermOutput :: Handle -> Terminal -> TermOutput -> IO () -- | Output plain text containing no control characters or escape -- sequences. 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 -- (e.g., clear and dch1) use this parameter on some -- terminals to compute variable-length padding. type LinesAffected = Int -- | Look up an output capability which takes a fixed number of parameters -- (for example, Int -> Int -> TermOutput). -- -- For capabilities which may contain variable-length padding, use -- tiGetOutput instead. tiGetOutput1 :: (OutputCap f) => String -> Capability f -- | A type class to encapsulate capabilities which take in zero or more -- parameters. class OutputCap f -- | The class of monoids (types with an associative binary operation that -- has an identity). Instances should satisfy the following laws: -- -- -- -- The method names refer to the monoid of lists under concatenation, but -- there are many other instances. -- -- Minimal complete definition: mempty and mappend. -- -- Some types can be viewed as a monoid in more than one way, e.g. both -- addition and multiplication on numbers. In such cases we often define -- newtypes and make those instances of Monoid, e.g. -- Sum and Product. class Monoid a mempty :: (Monoid a) => a mappend :: (Monoid a) => a -> a -> a mconcat :: (Monoid a) => [a] -> a -- | An operator version of mappend. (<#>) :: (Monoid m) => m -> m -> m instance (Enum a, OutputCap f) => OutputCap (a -> f) instance OutputCap TermOutput instance Monoid TermOutput instance MonadPlus Capability instance Monad Capability instance Functor Capability -- | The string capabilities in this module are the character sequences -- corresponding to user input such as arrow keys and function keys. module System.Console.Terminfo.Keys keypadOn :: Capability TermOutput keypadOff :: Capability TermOutput keyUp :: Capability String keyDown :: Capability String keyLeft :: Capability String keyRight :: Capability String -- | Look up the control sequence for a given function sequence. For -- example, functionKey 12 retrieves the kf12 -- capability. functionKey :: Int -> Capability String keyBackspace :: Capability String keyDeleteChar :: Capability String -- | This module provides capabilities for moving the cursor on the -- terminal. module System.Console.Terminfo.Cursor termLines :: Capability Int termColumns :: Capability Int -- | This flag specifies that the cursor wraps automatically from the last -- column 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 -- the last column of the previous line. autoLeftMargin :: Capability Bool -- | This flag specifies that the terminal does not perform -- autoRightMargin-style wrapping when the character which would -- cause the wraparound is a control character. This is also known as the -- "newline glitch" or "magic wrap". -- -- For example, in an 80-column terminal with this behavior, the -- following will print single-spaced instead of double-spaced: -- --
--   replicateM_ 5 $ putStr $ replicate 80 'x' ++ "\n"
--   
wraparoundGlitch :: Capability Bool -- | The cr capability, which moves the cursor to the first column -- of the current line. carriageReturn :: Capability TermOutput -- | The nel capability, which moves the cursor to the first -- column of the next line. It behaves like a carriage return followed by -- a line feed. -- -- If nel is not defined, this may be built out of other -- capabilities. newline :: Capability TermOutput scrollForward :: Capability TermOutput scrollReverse :: Capability TermOutput moveDown :: Capability (Int -> TermOutput) moveLeft :: Capability (Int -> TermOutput) moveRight :: Capability (Int -> TermOutput) moveUp :: Capability (Int -> TermOutput) cursorDown1 :: Capability TermOutput cursorLeft1 :: Capability TermOutput cursorRight1 :: Capability TermOutput cursorUp1 :: Capability TermOutput cursorDown :: Capability (Int -> TermOutput) cursorLeft :: Capability (Int -> TermOutput) cursorRight :: Capability (Int -> TermOutput) cursorUp :: Capability (Int -> TermOutput) cursorAddress :: Capability (Point -> TermOutput) data Point Point :: Int -> Int -> Point row :: Point -> Int col :: Point -> Int rowAddress :: Capability (Int -> TermOutput) columnAddress :: Capability (Int -> TermOutput) module System.Console.Terminfo.Effects bell :: Capability TermOutput visualBell :: Capability TermOutput withStandout :: Capability (TermOutput -> TermOutput) withUnderline :: Capability (TermOutput -> TermOutput) enterStandoutMode :: Capability TermOutput exitStandoutMode :: Capability TermOutput enterUnderlineMode :: Capability TermOutput exitUnderlineMode :: Capability TermOutput 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 :: Capability TermOutput -- | Clear from cursor to end of line. clearEOL :: Capability TermOutput -- | Clear display after cursor. clearEOS :: Capability (LinesAffected -> TermOutput) module System.Console.Terminfo