如何在本地使用hoogle(如ctags)?

gat*_*ado 10 haskell cabal haddock

我想在本地使用Hoogle,因此我可以在我的某个项目上运行搜索查询.[有一些文档这里 ],但我无法弄清楚如何得到它的工作.它说运行Haddock,但是haddock没有提供任何输出,只是吐出下面复制的警告.我还没有projectname.cabal文件,所以我无法使用该runhaskell Setup haddock --hoogle命令.

haddock coverage for ./Util.hs:     0/8   0%
haddock coverage for ./Blockify.hs:    0/16   0%
haddock coverage for ./Interpreter.hs:     0/9   0%
haddock coverage for AbstractSummarizer.hs:    0/10   0%
Warning: Util: could not find link destinations for:
    GHC.Base.String GHC.Types.IO GHC.ST.ST Data.StateRef.Types.HasRef GHC.Base.Monad Control.Applicative.Applicative GHC.Types.Int Control.Monad.Trans.State.Lazy.State GHC.Bool.Bool GHC.Types.Double GHC.Show.Show Data.Vector.Vector Data.Map.Map System.Process.Internals.CreateProcess
Warning: Blockify: could not find link destinations for:
    GHC.Types.Int GHC.Classes.Eq Data.Data.Data GHC.Classes.Ord GHC.Read.Read GHC.Show.Show Data.Typeable.Typeable GHC.Base.String Data.Typeable.Typeable1 GHC.Num.Num Control.Monad.Trans.State.Lazy.State
Warning: Interpreter: could not find link destinations for:
    Data.StateRef.Types.Ref GHC.Types.Int GHC.Classes.Eq Data.Data.Data GHC.Classes.Ord GHC.Read.Read GHC.Show.Show Data.Typeable.Typeable Data.Typeable.Typeable1 Control.Applicative.Applicative GHC.Base.Monad Data.Map.Map Data.Vector.Vector GHC.Base.Functor Data.Maybe.Maybe
Warning: AbstractSummarizer: could not find link destinations for:
    GHC.Types.Int GHC.Classes.Eq GHC.Show.Show Data.Sequence.Seq GHC.Classes.Ord GHC.Read.Read
Run Code Online (Sandbox Code Playgroud)

gat*_*ado 8

对不起,我的错,输出结果main.txt,我想我需要在某个时候清理我的项目.如果它没用,可以删除此问题.解决方案是:

PROJECTDIR> haddock --hoogle **/*.hs
PROJECTDIR> mv main.txt PROJNAME.txt
PROJECTDIR> hoogle convert PROJNAME.txt
PROJECTDIR> cp PROJNAME.txt PROJNAME.hoo HOOGLEDB
HOOGLEDB> hoogle combine -o default.hoo $(ls *.hoo | sed '/default/d')
Run Code Online (Sandbox Code Playgroud)

HOOGLEDB ~/.cabal/share/hoogle-4.2.5/databases适合我.请注意,只有具有声明类型签名的函数才包含在数据库中.

干杯.抱歉垃圾邮件.

  • 不要担心垃圾邮件; 鼓励回答一个人自己的问题.请务必接受您自己的答案,因为它对其他人有用. (6认同)