如何在Haskell中获取字符的ASCII值?我尝试使用GHCi中的
ord
函数,根据我在这里读到的信息,但是出现了以下错误信息:例如:Not in scope: `ord'
GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package ffi-1.0 ... linking ... done.
Prelude> ord 'a'
<interactive>:1:0: Not in scope: `ord'
Prelude>
我做错了什么?
:module +Data.Char
,或在你的源代码文件中使用import Data.Char
导入该模块。 - Travis Brownimport Data.Char
。 - newacctqualified
和c
似乎不起作用。 - Travis Brownqualified
工作正常! - is7s