我最近为我正在学习的编程课程安装了 Haskell Platform for Windows。它包括作为编译器的 GHCi 和作为打包系统的 Cabal。我一直在尝试使用 Cabal 安装 Craft3e 包,因为这是我的教科书使用的练习包,但无济于事。要安装 Craft3e,我只需cabal unpack Craft3e
在命令提示符中输入,它会创建目录“\Craft3e-0.1.0.8”。进入目录后,我输入cabal install --disable-documentation
,它给了我以下信息:
Resolving dependencies...
In order, the following would be installed:
time-1.2.0.5 (new version)
random-1.0.1.1 (reinstall) changes: time-1.4 -> 1.2.0.5
QuickCheck-2.5.1.1 (reinstall)
Craft3e-0.1.0.8 (new package)
cabal: The following packages are likely to be broken b
haskell-platform-2012.4.0.0
Use --force-reinstalls if you want to install anyway.
使用后cabal install --disable-documentation --force-reinstalls
,按预期安装。我加载了一个模块来测试它:ghci PicturesSVG
. 这成功加载。但是,一旦我退出 GHCi 编译器并重新进入它,我就无法再从 Craft3e 包中加载模块;相反,我收到消息:
GHCi, version 7.4.2: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
<command line>:
Could not find module `PicturesSVG'
it is a hidden module in the package `Craft3e-0.1.0.8'
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
发生了什么?当我进入时,包裹仍然出现ghc-pkg list
。我试过输入ghc-pkg expose Craft3e-0.1.0.8
,但提示告诉我:
WARNING: cache is out of date: C:/Program Files (x86)/Haskell Platform/2012.4.0.
0\lib\package.conf.d\package.cache
use 'ghc-pkg recache' to fix.
我已经完成了重新缓存,并重新输入了“公开”命令,但仍然没有结果。
任何解决方案将不胜感激!