简体   繁体   English

错误:模块“main:Course”在多个文件中定义:src/Course.hs

[英]Error: module ‘main:Course’ is defined in multiple files: src/Course.hs

I'm trying to start working on https://github.com/system-f/fp-course .我正在尝试开始研究https://github.com/system-f/fp-course After running stack ghci , it finishes with:运行stack ghci后,它以:

...
[51 of 51] Compiling Test.Loader      ( src/Test/Loader.hs, interpreted )
Ok, 51 modules loaded.
Loaded GHCi configuration from /home/lpied/haskell/fp-course/.ghci

<no location info>: error:
    module ‘main:Course’ is defined in multiple files: src/Course.hs
                                                       src/Course.hs
Failed, 51 modules loaded.
Loaded GHCi configuration from /tmp/haskell-stack-ghci/75d10d48/ghci-script

Any idea why it's complaining that the module is defined in the same file ( src/Course.hs )?知道为什么它抱怨模块是在同一个文件( src/Course.hs )中定义的吗?

Can you try using stack exec ghci instead?您可以尝试改用stack exec ghci吗? stack ghci is probably recognizing the src directory and adding -isrc to the ghci command line, and then the .ghci file in the course root directory is also adding -isrc to the ghci command line. stack ghci大概是在识别src目录并在ghci命令行中添加-isrc ,然后课程根目录下的.ghci文件也在ghci命令行中添加-isrc GHC probably doesn't de-duplicate its search path, so it acts like you have two separate directories which both happen to be named src . GHC 可能不会删除其搜索路径的重复项,因此它就像您有两个单独的目录一样,它们恰好都被命名为src

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM