summaryrefslogtreecommitdiff
path: root/libraries/base/tests/unicode001.hs
blob: ceac9a526522be438ea93990bd8099d8ec3fd885 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
-- !!! Tests the various character classifiactions for a selection of Unicode
-- characters.

module Main where

import Data.Char

main = do
  putStrLn ("            " ++ concat (map (++" ") strs))
  mapM putStrLn (map do_char chars)
 where
  do_char char = s ++ (take (12-length s) (repeat ' ')) ++ concat (map f bs)
    where
          s = show char
          bs = map ($char) functions
          f True  = "X     "
          f False = "      "

strs = ["upper","lower","alpha","alnum","digit","print","space","cntrl"]

functions = [isUpper,isLower,isAlpha,isAlphaNum,isDigit,isPrint,isSpace,isControl]

chars = [backspace,tab,space,zero,lower_a,upper_a,delete,
        right_pointing_double_angle_quotation_mark,
        greek_capital_letter_alpha,
        bengali_digit_zero,
        en_space,
        gothic_letter_ahsa,
        monospaced_digit_zero
        ]

backspace             = '\x08'
tab                   = '\t'
space                 = ' '
zero                  = '0'
lower_a               = 'a'
upper_a               = 'A'
delete                = '\x7f'
right_pointing_double_angle_quotation_mark = '\xBB'
latin_small_letter_i_with_caron = '\x1D0'
combining_acute_accent = '\x301'
greek_capital_letter_alpha = '\x0391'
bengali_digit_zero    = '\x09E6'
en_space              = '\x2002'
gothic_letter_ahsa    = '\x10330'
monospaced_digit_zero = '\x1D7F6'