How do you get Emacs haskell-mode to find modules in other hs-source-dirs?

217 Views Asked by At

UPDATE: clarified that this is on Mac OS X

I'm using Emacs Prelude (which uses haskell-mode) on Mac OS X and I've created a project with stack new hello.

The project it generates is like this:

  • hello:
    • LICENSE
    • Setup.hs
    • hello.cabal
    • stack.cabal
    • app:
      • Main.hs
    • src:
      • Lib.hs
    • test:
      • Spec.hs

If I open Main.hs in Emacs it shows this:

module Main where

import Lib

main :: IO ()
main = someFunc

But Lib is underlined as an error and placing my caret there shows this:

Could not find module 'Lib'
Use -v to see a list of the files searched for.

How do you get Emacs haskell-mode to find modules in other hs-source-dirs?

1

There are 1 best solutions below

4
Alain O'Dea On BEST ANSWER

The greatest horror is that I fixed this by rebooting.

I appear to have triggered it by breaking the path to Stack. The path changed from my original manual install to ~/Applications/bin/stack to ~/.local/bin/stack. I knew that had changed so I closed and relaunched Emacs, but the problem persisted.

Rebooting fixed it. This brings me sadness. I imagine logging out might have worked just as well.