gpt4 book ai didi

haskell - GHCi 错误 - "Not in scope: ` isUpper'"

转载 作者:行者123 更新时间:2023-12-02 15:10:50 28 4
gpt4 key购买 nike

我正在学习 haskell,我正在尝试编写一些简单的函数。在我使用函数 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 进行开发谢谢您的帮助

最佳答案

您需要导入 Data.Char获取isUpper

关于haskell - GHCi 错误 - "Not in scope: ` isUpper'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22235906/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com