1
我正在學習haskell,我正在嘗試編寫一些簡單的函數。一切運作良好,直到我使用功能isUpper
。我無法編譯,因爲這個錯誤的項目:GHCi錯誤 - 「不在範圍內:`isUpper'」
[1 of 1] Compiling Main (C:\Users\...\src\Main.hs, interpreted)
C:\Users\...\src\Main.hs:147:25:
Not in scope: `isUpper'
Failed, modules loaded: none.
Prelude>
我的代碼:
module Main where
main::IO()
main = undefined
stringIsUpper [] = True
stringIsUpper (x:ys) = (isUpper x) && (stringIsUpper(ys))
這段代碼的目標應該是隻是爲了檢查是否插入的字符串由大寫字母的。 我使用EclipseFP發展 謝謝您的幫助
'isUpper'是'Data.Char'中的一個函數,您必須先將其導入 – bheklilr
如果有疑問,請[hoogle it](http://www.haskell.org/hoogle/?hoogle=isUpper)。 – bheklilr
謝謝@bheklilr。有用。我只是認爲我不必寫入口,而且我也不知道在哪裏放置那些進口。 問題解決了 – user2151486