I am trying to setup my Haskero (Visual Studio Code extension that uses Intero) for my Haskell project, yet I get the following error :
app\Main.hs:3:1: error:
Failed to load interface for `Lib'
Use -v to see a list of the files searched for.
Steps to reproduce:
stack new project
cd project
stack build intero
stack exec intero
> :l app/Main.hs
app/Main.hs :
module Main where
import Lib
main :: IO ()
main = someFunc
src/Lib.hs :
module Lib
( someFunc
) where
someFunc :: IO ()
someFunc = putStrLn "someFunc"
I don't have experience with Haskero but can duplicate the problem with a plain old Intero installation on a Linux machine.
The issue is that you're invoking the Intero backend via stack exec
instead of stack ghci
. You would observe the same problem if you tried using stack exec ghci
instead of stack ghci
to invoke a usual GHC interactive session (see the documentation for stack ghci
for more information).
Instead of stack exec intero
, try:
stack ghci --with-ghc intero --no-build --no-load
and it should work okay.
(Note that stack exec intero
actually works okay if you stack build
your project first, but the interactive session is still supposed to be invoked via stack ghci
.)