Search code examples
unicodehaskellcodepoint

Haskell: convert unicode integer to actual unicode character


Suppose that my Haskell function is given an input, which is supposed to be the number of a unicode code point. How can one convert this to the corresponding character?

Example:

123 to '{'.


Solution

  • Use toEnum. (Chars implement the Enum typeclass.)