Numeric escape sequence out of range [GHC-21231]

The escape sequence in the Char literal is too large of a number. The maximum value of a numeric literal is \1114111 (or \x10ffff in hexadecimal and \o4177777 in octal).

Examples

Typo: lower-case class name

Error Message

EscapeSeqOutOfRange.hs:4:13: error:
    numeric escape sequence out of range at character '2'
  |
4 | x = '\1114112'
  |             ^

Explanation

This example shows that a numeric escape sequence with a value higher than 1114111 throws an error, but a number that is within range does not.

EscapeSeqOutOfRange.hs
Before
module EscapeSeqOutOfRange where

x :: Char
x = '\1114112'
After
module EscapeSeqOutOfRange where

x :: Char
x = '\1114111'