无法在Haskell中导入.lhs脚本

时间:2018-11-12 18:54:07

标签: haskell

我在同一文件夹中有两个文件,分别是S5.hsS6.lhs ,我想在S6.lhs中导入S5.hs脚本,但是当我输入import S6时,我得到:

Could not find module `S6'
Use -v to see a list of the files searched for.
|
1 | import S6
| ^^^^^^^^^^
Failed, no modules loaded.

当我从文件夹中放下它时,会收到以下消息(S6文件的第一行是 import Data.Array ):

    File name does not match module name:
Saw: `Main'
Expected: `S6'
|
1 | import Data.List
| ^

为什么会这样?

1 个答案:

答案 0 :(得分:3)

看起来您需要在S6.lhs文件的顶部指定您希望将此文件视为S6模块,而不是默认的模块名称Main 。您可以使用module S6 wheremodule S6 (export, list) where来做到这一点。