@@ -1,50 +1,65 @@
11
22module Char where
33
4+{-| Functions for working with characters.
5+
6+Like C, characters are enclosed in single quotes, and strings in double quotes.
7+Like Haskell, strings are just [lists](/docs/List.elm) of characters, so `"elm"
8+== ['e', 'l', 'm']`.
9+
10+# Classification
11+@docs isUpper, isLower, isDigit, isOctDigit, isHexDigit
12+
13+# Conversion
14+@docs toUpper, toLower, toLocaleUpper, toLocaleLower, toCode, fromCode
15+
16+-}
17+
418import Native.Char
519
6−-- True for upper case letters.
20+{-| True for upper case letters. -}
721isUpper : Char -> Bool
822isUpper = Native.Char.isUpper
923
10−-- True for lower case letters.
24+{-| True for lower case letters. -}
1125isLower : Char -> Bool
1226isLower = Native.Char.isLower
1327
14−-- True for ASCII digits (`0..9`).
28+{-| True for ASCII digits `[0-9]`. -}
1529isDigit : Char -> Bool
1630isDigit = Native.Char.isDigit
1731
18−-- True for ASCII octal digits (`0..7`).
32+{-| True for ASCII octal digits `[0-7]`. -}
1933isOctDigit : Char -> Bool
2034isOctDigit = Native.Char.isOctDigit
2135
22−-- True for ASCII hexadecimal digits (`0..9a..fA..F`).
36+{-| True for ASCII hexadecimal digits `[0-9a-fA-F]`. -}
2337isHexDigit : Char -> Bool
2438isHexDigit = Native.Char.isHexDigit
2539
26−-- Convert to upper case.
40+{-| Convert to upper case. -}
2741toUpper : Char -> Char
2842toUpper = Native.Char.toUpper
2943
30−-- Convert to lower case.
44+{-| Convert to lower case. -}
3145toLower : Char -> Char
3246toLower = Native.Char.toLower
3347
34−-- Convert to upper case, according to any locale-specific case mappings.
48+{-| Convert to upper case, according to any locale-specific case mappings. -}
3549toLocaleUpper : Char -> Char
3650toLocaleUpper = Native.Char.toLocaleUpper
3751
38−-- Convert to lower case, according to any locale-specific case mappings.
52+{-| Convert to lower case, according to any locale-specific case mappings. -}
3953toLocaleLower : Char -> Char
4054toLocaleLower = Native.Char.toLocaleLower
4155
4256type KeyCode = Int
4357
44−-- Convert to unicode.
58+{-| Convert to unicode. Used with the [`Keyboard`](/docs/Keyboard.elm)
59+library, which expects the input to be uppercase. -}
4560toCode : Char -> KeyCode
4661toCode = Native.Char.toCode
4762
48−-- Convert from unicode.
63+{-| Convert from unicode. -}
4964fromCode : KeyCode -> Char
5065fromCode = Native.Char.fromCode