【发布时间】:2020-08-30 05:42:37
【问题描述】:
随着 cabal-3 的发布,来自 Hackage 的软件包安装在编译器 ghc 和 ghc-pkg 不知道的新位置。
换句话说,软件包已安装但未注册ghc。 Ghci、ghc、ghc-pkg 无法工作。
例如,
cabal install safe --lib
创建文件 t1.hs
import Safe
t1 = tailMay [1,2,3]
让我们试试吧:
> ghci t1.hs
GHCi, version 8.10.2: https://www.haskell.org/ghc/:? for help
[1 of 1] Compiling Main (t1.hs, interpreted)
t1.hs: 1: 1: error:
Could not find module `Safe '
Use -v (or `: set -v` in ghci) to see a list of the files searched for.
|
1 | import Safe
| ^^^^^^^^^^^
Failed, no modules loaded.
这里描述了这个错误
https://github.com/haskell/cabal/issues/6262
这里
https://gitlab.haskell.org/ghc/ghc/-/issues/17341
我使用设置系统变量作为临时解决方案
GHC_PACKAGE_PATH=C:\Users\me\AppData\Roaming\cabal\store\ghc-8.10.2\package.db;
(Windwos 10,巧克力的 haskell-dev)
通过 On Windows, packages installed with cabal seem to be unavailable in ghc/ghci
但随着更新,我将不得不手动更改此系统变量。
对于这个问题还有更优雅的解决方案吗?
附:不幸的是,这个解决方案(通过 GHC 的环境变量 GHC_PACKAGE_PATH)与 Cabal 不兼容:(
【问题讨论】:
标签: haskell ghc cabal cabal-new ghc-pkg