开发者

Haskell module not found. What is wrong with my project's file structure?

开发者 https://www.devze.com 2023-04-04 01:01 出处:网络
I have a problem with my project structure: pic-analysis-0.1/AlgTop/Data.hs Functions.hs PNGModify.hs Main.hs

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:

mod开发者_如何学Cule 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
[...]


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.


No need to set anything. Just cd into the root directory before invoking GHCi:

ghci AlgTop/Functions.hs
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号