@@ -1,50 +1,65 @@
2module Char where
2module Char where
4+{-| Functions for working with characters.
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"
11+@docs isUpper, isLower, isDigit, isOctDigit, isHexDigit
14+@docs toUpper, toLower, toLocaleUpper, toLocaleLower, toCode, fromCode
4import Native.Char
18import Native.Char
6−-- True for upper case letters.
20+{-| True for upper case letters. -}
7isUpper : Char -> Bool
21isUpper : Char -> Bool
8isUpper = Native.Char.isUpper
22isUpper = Native.Char.isUpper
10−-- True for lower case letters.
24+{-| True for lower case letters. -}
11isLower : Char -> Bool
25isLower : Char -> Bool
12isLower = Native.Char.isLower
26isLower = Native.Char.isLower
14−-- True for ASCII digits (`0..9`).
28+{-| True for ASCII digits `[0-9]`. -}
15isDigit : Char -> Bool
29isDigit : Char -> Bool
16isDigit = Native.Char.isDigit
30isDigit = Native.Char.isDigit
18−-- True for ASCII octal digits (`0..7`).
32+{-| True for ASCII octal digits `[0-7]`. -}
19isOctDigit : Char -> Bool
33isOctDigit : Char -> Bool
20isOctDigit = Native.Char.isOctDigit
34isOctDigit = Native.Char.isOctDigit
22−-- True for ASCII hexadecimal digits (`0..9a..fA..F`).
36+{-| True for ASCII hexadecimal digits `[0-9a-fA-F]`. -}
23isHexDigit : Char -> Bool
37isHexDigit : Char -> Bool
24isHexDigit = Native.Char.isHexDigit
38isHexDigit = Native.Char.isHexDigit
26−-- Convert to upper case.
40+{-| Convert to upper case. -}
27toUpper : Char -> Char
41toUpper : Char -> Char
28toUpper = Native.Char.toUpper
42toUpper = Native.Char.toUpper
30−-- Convert to lower case.
44+{-| Convert to lower case. -}
31toLower : Char -> Char
45toLower : Char -> Char
32toLower = Native.Char.toLower
46toLower = Native.Char.toLower
34−-- Convert to upper case, according to any locale-specific case mappings.
48+{-| Convert to upper case, according to any locale-specific case mappings. -}
35toLocaleUpper : Char -> Char
49toLocaleUpper : Char -> Char
36toLocaleUpper = Native.Char.toLocaleUpper
50toLocaleUpper = Native.Char.toLocaleUpper
38−-- Convert to lower case, according to any locale-specific case mappings.
52+{-| Convert to lower case, according to any locale-specific case mappings. -}
39toLocaleLower : Char -> Char
53toLocaleLower : Char -> Char
40toLocaleLower = Native.Char.toLocaleLower
54toLocaleLower = Native.Char.toLocaleLower
42type KeyCode = Int
56type KeyCode = Int
44−-- Convert to unicode.
58+{-| Convert to unicode. Used with the [`Keyboard`](/docs/Keyboard.elm)
59+library, which expects the input to be uppercase. -}
45toCode : Char -> KeyCode
60toCode : Char -> KeyCode
46toCode = Native.Char.toCode
61toCode = Native.Char.toCode
48−-- Convert from unicode.
63+{-| Convert from unicode. -}
49fromCode : KeyCode -> Char
64fromCode : KeyCode -> Char
50fromCode = Native.Char.fromCode
65fromCode = Native.Char.fromCode