[英]Manage hoogle index using stack tool
Context: Before stack
I stopped using hoogle
locally because my index would somehow lose sync with installed packages. 上下文:在stack
之前我停止在本地使用hoogle
,因为我的索引会以某种方式失去与已安装包的同步。 If I recall correctly, I had issues with different results in ghci
, command line and cabal
sandboxes. 如果我没记错的话,我在ghci
,命令行和cabal
沙箱中遇到了不同结果的问题。
Can I leverage stack
environment manage my local hoogle
databases? 我可以利用stack
环境管理我的本地hoogle
数据库吗?
For the Hoogle part I recommend using the latest git version, which will become version 5. To install that, do: 对于Hoogle部分,我建议使用最新的git版本,它将成为版本5.要安装它,请执行:
git clone https://github.com/ndmitchell/hoogle.git
cd hoogle
stack init
stack install
Then generate it and use it with: 然后生成它并使用它:
# generate Haddock docs for all your packages
stack haddock
# generate the Hoogle index
stack exec -- hoogle generate --local --database=.stack-work/hoogle
# perform a search for map
stack exec -- hoogle map --database=.stack-work/hoogle
# start a server at http://127.0.0.1/ to browse docs
stack exec -- hoogle server --local --database=.stack-work/hoogle
To make this work with Cabal instead of Stack, do cabal install
initially, set your haddock
/ hoogle
preference in your Cabal config file to True
, and remove the stack exec
bits. 要使用Cabal而不是Stack进行此操作, cabal install
进行cabal install
,将Cabal配置文件中的haddock
/ hoogle
首选项设置为True
,然后删除stack exec
位。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.