GHC 找不到模块但 GHCi 可以

GHC could not find module but GHCi can

我之前安装了 tidal 软件包 cabl install tidal

当 运行 ghc Tidal.hs:

Tidal.hs:4:1: error:
    Could not find module ‘Sound.Tidal.Context’
    There are files missing in the ‘tidal-0.9.6’ package,
    try running 'ghc-pkg check'.
    Locations searched:
      Sound/Tidal/Context.hs
      Sound/Tidal/Context.lhs
      Sound/Tidal/Context.hsig
      Sound/Tidal/Context.lhsig
      /home/chris/.cabal/lib/x86_64-linux-ghc-8.2.2/tidal-0.9.6-HlQOMGZHP8JDJBhFqbDzA/Sound/Tidal/Context.hi
  |
4 | import Sound.Tidal.Context

在最后一个文件路径中,该文件确实不存在,但有以 .dyn_hi 结尾的文件。因此,确实存在的文件的完整路径是: /home/chris/.cabal/lib/x86_64-linux-ghc-8.2.2/tidal-0.9.6-HlQOMGZHP8JDJBhFqbDzA/Sound/Tidal/Context.dyn_hi

错误的原因可能是什么?我能够在 ghci.

内成功导入模块

我通读了这个:https://ghc.haskell.org/trac/ghc/wiki/DynamicLinkingDebate

运行 它带有 -dynamic 标志似乎可以修复它:ghc -dynamic Tidal.hs