Char package:base

The character type Char represents Unicode codespace and its elements are code points as in definitions D9 and D10 of the Unicode Standard. Character literals in Haskell are single-quoted: 'Q', 'Я' or 'Ω'. To represent a single quote itself use '\'', and to represent a backslash use '\\'. The full grammar can be found in the section 2.6 of the Haskell 2010 Language Report. To specify a character by its code point one can use decimal, hexadecimal or octal notation: '\65', '\x41' and '\o101' are all alternative forms of 'A'. The largest code point is '\x10ffff'. There is a special escape syntax for ASCII control characters: TODO: table Data.Char provides utilities to work with Char.
The Char type and associated operations.
Character literal
Parses and returns the specified character.
Convert a character to its Unicode code point (cf. ord)
An encoding in which Unicode code points are translated to bytes by taking the code point modulo 256. When decoding, bytes are translated directly into the equivalent code point. This encoding never fails in either direction. However, encoding discards information, so encode followed by decode is not the identity.
Determines whether a character can be accurately encoded in a CString. Pretty much anyone who uses this function is in a state of sin because whether or not a character is encodable will, in general, depend on the context in which it occurs.
Read a single character from the standard input device. getChar is implemented as hGetChar stdin. This operation may fail with the same errors as hGetChar.

Examples

>>> getChar
a'a'
>>> getChar
>
'\n'
Write a character to the standard output device putChar is implemented as hPutChar stdout. This operation may fail with the same errors as hPutChar.

Examples

Note that the following do not put a newline.
>>> putChar 'x'
x
>>> putChar '\0042'
*
utility function converting a Char to a show function that simply prepends the character unchanged.
Read a string representation of a character, using Haskell source-language escape conventions. For example:
lexLitChar  "\\nHello"  =  [("\\n", "Hello")]
Read a string representation of a character, using Haskell source-language escape conventions, and convert it to the character that it encodes. For example:
readLitChar "\\nHello"  =  [('\n', "Hello")]
Convert a character to a string using only printable characters, using Haskell source-language escape conventions. For example:
showLitChar '\n' s  =  "\\n" ++ s
Makes a constructor for Char.