I want to use Hoogle locally, so I can run search queries on one of my projects. There's some documentation [ here ], but I can't figure out how to get it to work. It says to run Haddock, but haddock doesn't give any output, only spitting out the warnings copied below. I don't have a projectname.cabal file yet, so I can't use the runhaskell Setup haddock --hoogle
command.
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
Sorry, my fault, the output was in main.txt
, I guess I need to clean up my project sometime. This question can be deleted if it's not useful. The solution is:
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')
HOOGLEDB is ~/.cabal/share/hoogle-4.2.5/databases
for me. note that only functions with declared type signatures are included in the database.
cheers. sorry to spam.