我正在尝试从Learn You a Haskell for Great Good编译此函数。
removeNonUppercase st = [ c | c <- st, c `elem` ['A'..'Z']]
将其放入removeNonUpperCase.hs文件中。
它编译得很好,但在传递参数时:
ghci> removeNonUppercase "Hahaha! Ahahaha!"
编译器说:
<interactive>:1:0: Not in scope: 'removeNonUpperCase'
为什么呢?
PrintScreen: http://img535.imageshack.us/img535/9545/notinscope.png
答案 0 :(得分:7)
您将方法定义为removeNonUppercase
(小写c),但您将其称为removeNonUpperCase
(大写C)。