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 execinstead ofstack ghci. You would observe the same problem if you tried usingstack exec ghciinstead ofstack ghcito invoke a usual GHC interactive session (see the documentation forstack ghcifor more information).Instead of
stack exec intero, try:and it should work okay.
(Note that
stack exec interoactually works okay if youstack buildyour project first, but the interactive session is still supposed to be invoked viastack ghci.)