[英]How to load multiple .hs files with only functions (no modules) into haskell ghci?
我可以使用:l addOne.hs
具有单个功能的单个haskell文件加载到ghci中
如果我加载另一个haskell文件:l addTwo.hs
它将擦除对另一个文件的引用,并且我得到Variable not in scope: addOne
的Variable not in scope: addOne
尝试调用addOne
时出现Variable not in scope: addOne
错误
addOne.hs
addOne x = x + 1
addTwo.hs
addTwo x = x + 2
还有其他几篇关于加载多个模块的文章。 是实现以上将它们转换为模块并调用的唯一方法
> :load Module1 Module2
> :module Module1 Module2
参考: https : //www.haskell.org/onlinereport/haskell2010/haskellch5.html#x11-990005.1
允许使用仅由模块主体组成的模块的缩写形式。 如果使用此选项,则将标头假定为
module Main(main) where
。
我认为您不能在ghci
加载两个名称相同的模块(模块的真实名称;您可以使用别名限定导入)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.