为什么在Haskell中,"Char"用“\”符号表示?这么设计的?
Why in Haskell, "Char" is represented by "\" symbol? Designed like this?
Prelude> maxBound::(Bool,Int,Char)
(True,9223372036854775807,'14111')
Prelude> minBound::Char
'\NUL'
为什么显示的是\NUL,而不是'\1114111'这样的数字?
Haskell中的Char
表示Unicode符号。
第一个符号的代码为 0
,在 Unicode 中定义为 NULL
。它也是 ASCII 字符集的一部分,每个人都会将 \NUL
(以及 \NULL
)与 0
.
联系起来
最大可能符号的代码为 1114111
(0x10ffff
),定义为 Noncharacter
. There are at least two Unicode symbols named Noncharacter
: the second is 0x10fffe
。
Prelude> maxBound::(Bool,Int,Char)
(True,9223372036854775807,'14111')
Prelude> minBound::Char
'\NUL'
为什么显示的是\NUL,而不是'\1114111'这样的数字?
Char
表示Unicode符号。
第一个符号的代码为 0
,在 Unicode 中定义为 NULL
。它也是 ASCII 字符集的一部分,每个人都会将 \NUL
(以及 \NULL
)与 0
.
最大可能符号的代码为 1114111
(0x10ffff
),定义为 Noncharacter
. There are at least two Unicode symbols named Noncharacter
: the second is 0x10fffe
。