未找到 Haskell 模块。我的项目的文件结构有什么问题?
我的项目结构有问题:
pic-analysis-0.1/AlgTop/Data.hs
Functions.hs
PNGModify.hs
Main.hs
Data.hs
:
module AlgTop.Data (…) where
Functions.hs
:
module AlgTop.Functions (…) where
import AlgTop.Data
AlgTop .Functions
模块找不到 AlgTop.Data
。
我将我的项目结构方法与 Hackage 上的 ansi-terminal
进行了比较(见下文),但我没有发现任何差异。我做错了什么?
ansi-terminal-xxx/System/Console/ANSI/Common.hs
/Unix.hs
/…
Common.hs
:
module System.Console.ANSI.Common where
Unix.hs
:
module System.Console.ANSI.Unix (…) where
import System.Console.ANSI.Common
错误消息:
[...]
*** Chasing dependencies:
Chasing modules from: *Functions.hs
Functions.hs:9:8:
Could not find module `AlgTop.Data':
locations searched:
AlgTop/Data.hs
AlgTop/Data.lhs
[...]
I have a problem with my project structure:
pic-analysis-0.1/AlgTop/Data.hs
Functions.hs
PNGModify.hs
Main.hs
Data.hs
:
module AlgTop.Data (…) where
Functions.hs
:
module AlgTop.Functions (…) where
import AlgTop.Data
The AlgTop.Functions
module doesn't find AlgTop.Data
.
I compared my project structure approach with that of ansi-terminal
on Hackage (see below), but I couldn't spot any difference. What am I doing wrong?
ansi-terminal-xxx/System/Console/ANSI/Common.hs
/Unix.hs
/…
Common.hs
:
module System.Console.ANSI.Common where
Unix.hs
:
module System.Console.ANSI.Unix (…) where
import System.Console.ANSI.Common
Error message:
[...]
*** Chasing dependencies:
Chasing modules from: *Functions.hs
Functions.hs:9:8:
Could not find module `AlgTop.Data':
locations searched:
AlgTop/Data.hs
AlgTop/Data.lhs
[...]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 ghci,则可能需要
:set -i/.../pic-analysis-0.1
。也就是说,包含模块层次结构的根目录。If you are using ghci it is probably that you need to
:set -i/.../pic-analysis-0.1
. That is, include the root directory of your module hierarchy.不需要设置任何东西。在调用 GHCi 之前只需 cd 进入根目录:
No need to set anything. Just cd into the root directory before invoking GHCi: