如何将 GHCi 与新的 Cabal 1.17 沙箱一起使用? [英] How can I use GHCi with the new cabal 1.17 sandboxes?
问题描述
我一直在尝试 cabal head,它支持类似于 cabal-dev 的沙箱.然而,目前尚不支持 cabal-dev ghci
等价物和 显然下一个版本没有计划支持.
I've been trying out cabal head which has support for sandboxes similar to cabal-dev. However there's not yet support for a cabal-dev ghci
equivalent and apparently no support planned for the next release.
是否有一些咒语我可以用来解决这个问题并获得类似于 cabal-dev ghci
的东西?
Is there some incantation I can use to work around this and get something similar to cabal-dev ghci
?
推荐答案
edit(2013 年 8 月):cabal repl
补丁最近已合并.此功能将成为下一个版本的一部分.
edit (August 2013): The cabal repl
patches have recently been merged. This functionality will be a part of the next release.
在撰写本文时,没有类似于 cabal-dev ghci
的易于使用的类似物.我们计划在未来添加一个 cabal repl
命令 - 然而,目前这个功能不在 Cabal HEAD 中.
As of this writing, there is no easy-to-use analogue to cabal-dev ghci
. We plan to add a cabal repl
command in the future - however, at the moment this functionality is not in Cabal HEAD.
在此期间,您可以尝试以下解决方法:
In the meantime, you can try the following workaround:
$ cd $YOUR_PACKAGE_DIR
# For GHC >= 7.6
$ ghci -no-user-package-db -package-db .cabal-sandbox/i386-linux-ghc-7.6.1-packages.conf.d
# For GHC < 7.6
$ ghci -no-user-package-conf -package-conf .cabal-sandbox/i386-linux-ghc-7.4.2-packages.conf.d
这不会使您的包的模块立即从 ghci
可用 - 您必须使用 :l
或 import
加载它们(在存在自定义预处理器和 CPP 的情况下可能会中断).
This won't make the modules of your package immediately available from ghci
- you will have to load them with :l
or import
(which can break in the presence of custom preprocessors and CPP).
这篇关于如何将 GHCi 与新的 Cabal 1.17 沙箱一起使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!