-- 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 POSIX systems to -- interact with a variety of terminals using a standard set of -- capabilities. @package terminfo @version 0.3.1 -- | 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. -- -- Throws a SetupTermError if the terminfo database could not be -- read. 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. -- -- Throws a SetupTermError if the terminfo database could not be -- read. setupTermFromEnv :: IO Terminal data SetupTermError -- | 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: This -- function is deprecated; use tiGetOutput1 instead. tiGetStr :: String -> Capability String -- | 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 class OutputCap f class (Monoid s, OutputCap s) => TermStr s -- | 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 () 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 -- | The class of monoids (types with an associative binary operation that -- has an identity). Instances should satisfy the following laws: -- --
-- 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 :: (TermStr s) => Capability s -- | 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 :: (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 -> Int -> Point row :: Point -> Int col :: Point -> Int rowAddress :: (TermStr s) => Capability (Int -> s) columnAddress :: (TermStr s) => Capability (Int -> s) module System.Console.Terminfo.Effects -- | Sound the audible bell. bell :: (TermStr s) => Capability s -- | Present a visual alert using the flash capability. visualBell :: Capability TermOutput data Attributes Attributes :: Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Bool -> Attributes standoutAttr :: Attributes -> Bool underlineAttr :: Attributes -> Bool reverseAttr :: Attributes -> Bool blinkAttr :: Attributes -> Bool dimAttr :: Attributes -> Bool boldAttr :: Attributes -> Bool invisibleAttr :: Attributes -> Bool protectedAttr :: Attributes -> Bool -- | These attributes have all properties turned off. defaultAttributes :: Attributes -- | Sets the attributes on or off before outputting the given text, and -- then turns them all off. This capability will always succeed; -- properties which cannot be set in the current terminal will be -- ignored. withAttributes :: (TermStr s) => Capability (Attributes -> s -> s) -- | Sets the attributes on or off. This capability will always succeed; -- properties which cannot be set in the current terminal will be -- ignored. setAttributes :: (TermStr s) => Capability (Attributes -> s) -- | Turns off all text attributes. This capability will always succeed, -- but it has no effect in terminals which do not support text -- attributes. allAttributesOff :: (TermStr s) => Capability s -- | Turns on standout mode before outputting the given text, and then -- turns it off. withStandout :: (TermStr s) => Capability (s -> s) -- | Turns on underline mode before outputting the given text, and then -- turns it off. withUnderline :: (TermStr s) => Capability (s -> s) -- | Turns on bold mode before outputting the given text, and then turns -- all 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 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.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 -- outputting the given text, and then restores the terminal to its -- default foreground and background colors. withForegroundColor :: (TermStr s) => Capability (Color -> s -> s) -- | This capability temporarily sets the terminal's background color while -- outputting the given text, and then restores the terminal to its -- default foreground and background colors. withBackgroundColor :: (TermStr s) => Capability (Color -> s -> s) -- | Sets the foreground color of all further text output, using either the -- setaf or setf capability. setForegroundColor :: (TermStr s) => Capability (Color -> s) -- | Sets the background color of all further text output, using either the -- setab or setb capability. setBackgroundColor :: (TermStr s) => Capability (Color -> s) -- | Restores foreground/background colors to their original settings. restoreDefaultColors :: (TermStr s) => Capability s module System.Console.Terminfo