@@ -1,14 +1,20 @@
1−module Prelude.Char
1+module Prelude.Chars
2-- Functions operating over Chars
2-- Functions operating over Chars
4import Prelude.Bool
4import Prelude.Bool
5import Prelude.Classes
5import Prelude.Classes
6import Prelude.List
6import Prelude.List
7import Builtins
8import Builtins
9||| Return the ASCII representation of the character.
10||| Return the ASCII representation of the character.
10chr : Int -> Char
11chr : Int -> Char
12+chr x = if (x >= 0 && x < 0x11000)
11−chr x = prim__intToChar x
13+ then assert_total (prim__intToChar x)
16+instance Cast Int Char where
13||| Convert the number to its ASCII equivalent.
19||| Convert the number to its ASCII equivalent.
14ord : Char -> Int
20ord : Char -> Int
@@ -48,14 +54,14 @@ isNL x = x == '\r' || x == '\n'
48||| Non-letters are ignored.
54||| Non-letters are ignored.
49toUpper : Char -> Char
55toUpper : Char -> Char
50toUpper x = if (isLower x)
56toUpper x = if (isLower x)
51− then (prim__intToChar (prim__charToInt x - 32))
57+ then assert_total (prim__intToChar (prim__charToInt x - 32))
54||| Convert a letter to the corresponding lower-case letter, if any.
60||| Convert a letter to the corresponding lower-case letter, if any.
55||| Non-letters are ignored.
61||| Non-letters are ignored.
56toLower : Char -> Char
62toLower : Char -> Char
57toLower x = if (isUpper x)
63toLower x = if (isUpper x)
58− then (prim__intToChar (prim__charToInt x + 32))
64+ then assert_total (prim__intToChar (prim__charToInt x + 32))
61||| Returns true if the character is a hexadecimal digit i.e. in the range [0-9][a-f][A-F]
67||| Returns true if the character is a hexadecimal digit i.e. in the range [0-9][a-f][A-F]