简体   繁体   中英

GHCI - Failed to load interface for

To reproduce git clone https://github.com/ndmitchell/hoogle and in stack repl :

λ > :l src/Hoogle.hs 
[ 1 of 27] Compiling Input.Settings   ( src/Input/Settings.hs, interpreted )

src/Input/Settings.hs:17:1: error:
    Failed to load interface for ‘Paths_hoogle’
    Use -v to see a list of the files searched for.
Failed, modules loaded: none.

This seems to be caused by Paths_hoogle being a hidden-modules but I do not know what the solution is to get src/Hoogle.hs to load.

The hoogle project does not have a stack.yaml , so stack does not recognize that it is in a project. stack repl and stack ghci will open a GHCi environment in the implicit global project.

It might be wise for stack to check for a .cabal file in the current directory and warn if it's not in a stack project.

I was able to load the library by doing stack init to generate an initial stack.yaml file. Then stack repl and stack ghci both worked fine, loading both exposed and hidden modules.

The solution was to run GHCI repl using:

cabal repl lib:hoogle

This automatically loaded the Hoogle module:

Ok, modules loaded: Action.CmdLine, Action.Generate, Action.Search, Action.Server, Action.Test, General.Conduit, General.IString, General.Log, General.Store, General.Str, General.Template, General.Timing, General.Util, General.Web, Hoogle, Input.Cabal, Input.Download, Input.Haddock, Input.Item, Input.Reorder, Input.Set, Input.Settings, Output.Items, Output.Names, Output.Tags, Output.Types, Paths_hoogle, Query.
λ > defaultDatabaseLocation 
"/home/neo/.hoogle/default-haskell-5.0.13.hoo"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM