HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Basic data types

0 declarations

Cursor movement by character

4 declarations

These functions yield "" when the number is 0 as, on some terminals, a 0 parameter for the underlying 'ANSI' code specifies a default parameter of 1.

Cursor movement by line

2 declarations

These functions yield the equivalent of setCursorColumnCode 0 when the number is 0 as, on some terminals, a 0 parameter for the underlying 'ANSI' code specifies a default parameter of 1.

Directly changing cursor position

2 declarations
valuesetCursorColumnCode
  1. :: Int

    0-based column to move to

  2. -> String
#

Code to move the cursor to the specified column. The column numbering is 0-based (that is, the left-most column is numbered 0).

valuesetCursorPositionCode
  1. :: Int

    0-based row to move to

  2. -> Int

    0-based column to move to

  3. -> String
#

Code to move the cursor to the specified position (row and column). The position is 0-based (that is, the top-left corner is at row 0 column 0).

Saving, restoring and reporting cursor position

3 declarations

Code to emit the cursor position into the console input stream, immediately after being recognised on the output stream, as: ESC [ <cursor row> ; <cursor column> R

Note that the information that is emitted is 1-based (the top-left corner is at row 1 column 1) but setCursorPositionCode is 0-based.

In isolation of System.Console.ANSI.getReportedCursorPosition or System.Console.ANSI.getCursorPosition, this function may be of limited use on Windows operating systems because of difficulties in obtaining the data emitted into the console input stream.

Clearing parts of the screen

6 declarations

Enabling and disabling automatic line wrapping

2 declarations

These functions control whether or not characters automatically wrap to the next line when the cursor reaches the right border.

Scrolling the screen

2 declarations

These functions yield "" when the number is 0 as, on some terminals, a 0 parameter for the underlying 'ANSI' code specifies a default parameter of 1.

Using screen buffers

2 declarations

Reporting background or foreground colors

1 declaration

Code to emit the foreground or backgrond layer color into the console input stream, immediately after being recognised on the output stream, as:

ESC ] <Ps> ; rgb: <red> ; <green> ; <blue> <ST>

where <Ps> is 10 for Foreground and 11 for Background; <red>, <green> and <blue> are the color channel values in hexadecimal (4, 8, 12 and 16 bit values are possible, although 16 bit values are most common); and <ST> is the STRING TERMINATOR (ST). ST depends on the terminal software and may be the BEL character or ESC \ characters.

This function may be of limited, or no, use on Windows operating systems because (1) the control character sequence is not supported on native terminals (2) of difficulties in obtaining the data emitted into the console input stream. See System.Console.ANSI.getReportedLayerColor.

Underlining is not supported.

Select Graphic Rendition mode: colors and other whizzy stuff

1 declaration
valuesetSGRCode
  1. :: [SGR]

    Commands: these will typically be applied on top of the current console SGR mode. An empty list of commands is equivalent to the list [Reset]. Commands are applied left to right.

  2. -> String
#

Cursor visibilty changes

2 declarations

Hyperlinks

3 declarations

Some, but not all, terminals support hyperlinks - that is, clickable text that points to a URI.

valuehyperlinkWithIdCode
  1. :: String

    Identifier for the link

  2. -> String

    URI

  3. -> String

    Link text

  4. -> String
#

Code to introduce a hyperlink with an identifier for the link. Some terminals support an identifier, so that hyperlinks with the same identifier are treated as connected.

valuehyperlinkWithParamsCode
  1. :: [(String, String)]

    Parameters

  2. -> String

    URI

  3. -> String

    Link text

  4. -> String
#

Code to introduce a hyperlink with (key, value) parameters. Some terminals support an id parameter key, so that hyperlinks with the same id value are treated as connected.

Changing the title

1 declaration
valuesetTitleCode
  1. :: String

    New window title and icon name

  2. -> String
#

Code to set the terminal window title and the icon name (that is, the text for the window in the Start bar, or similar).

Utilities

9 declarations
typetype Parameter = Int
#

Type synonym representing parameter values (without parameter substrings). To represent a paramater value followed by a parameter substring, see ParamWithSubs.

typetype SubParam = Maybe Int
#

Type synonym representing parameter elements of a parameter substring. An empty parameter element (which represents a default value for the parameter element) has value Nothing.

typetype ParamWithSubs = (Parameter, [SubParam])
#

Type synonym representing parameter values optionally followed by a parameter substring. Parameter substrings were introduced by 13.1.8 of T.416 (03/93) for SGR parameter values 38 and 48 and have subsequently been adapted for other uses.

valuecsi
  1. :: [Parameter]

    List of parameters for the control sequence.

  2. -> String

    Character(s) that identify the control function.

  3. -> String
#

csi parameters controlFunction, where parameters is a list of Int, returns the control sequence comprising the control function CONTROL SEQUENCE INTRODUCER (CSI) followed by the parameter(s) (separated by ';') and ending with the controlFunction character(s) that identifies the control function. See csi' for a function that handles parameter values that may be followed by a parameter substring.

valuecsi'
  1. :: [ParamWithSubs]

    List of parameters (each of which may be followed by a parameter substring).

  2. -> String

    Characters(s) that identify the control function.

  3. -> String
#

Like csi but extended to parameters that may be followed by a parameter substring. The parameter elements of a parameter substring are separated from the parameter value and each other by ':'.

valueosc
  1. :: String

    Ps parameter

  2. -> String

    Pt parameter(s)

  3. -> String
#

osc parameterS parametersT, where parameterS specifies the type of operation to perform and parametersT is the other parameter(s) (if any), returns the control sequence comprising the control function OPERATING SYSTEM COMMAND (OSC) followed by the parameters (separated by ';') and ending with the STRING TERMINATOR (ST) "\ESC\\".

valuesgrToCode
  1. :: SGR

    The SGR aspect

  2. -> [Parameter]
#

sgrToCode sgr returns the parameter of the SELECT GRAPHIC RENDITION (SGR) aspect identified by sgr. If the parameter is followed by a parameter substring returns an empty list. See sgrToCode' for a function that handles also parameter values that are followed by a parameter substring.