【发布时间】:2020-04-27 11:31:16
【问题描述】:
你好,我正在使用 sublime text 3 和我的 cmd shell 和 ghci。 我在 st3 中编写了以下函数:
testing :: Int -> Bool
testing 0 = True
testing 1 = False
testing n = testing(n mod 2)
我知道 haskell 提供了一个偶函数,但我们必须编写自己的偶函数,所以我想出了这个。当我将文件加载到 ghci 中时:
:cd <pathtofile>
:l myfile.hs
并尝试使用
执行我的功能testing 10
我得到这个错误:
Variable not in scope: testing :: t0 -> t
我可能应该提到 testing :: Int -> Bool 与斐波那契函数共享文件,但是 那不应该是问题吧? 任何帮助表示赞赏!
【问题讨论】:
-
执行
:l myfile.hs命令会发生什么? -
它说'好的,加载了一个模块'
-
我尝试重新启动一切,发现我需要使用
mod而不是 mod。现在工作得很好!
标签: haskell sublimetext3 ghci