I have a situation where ghc-mod
can't find a module installed in my ~/.ghc/ directory.
The program (foo.hs) is just:
import Control.Monad.Loops
main = undefined
ghci
loads foo.hs
without any errors.
ghc-pkg list
produces the output:
/Library/Frameworks/GHC.framework/Versions/7.8.3-x86_64/usr/lib/ghc-7.8.3/package.conf.d
Cabal-1.18.1.4
GLURaw-1.4.0.1
...
~/.ghc/x86_64-darwin-7.8.3/package.conf.d:
...
monad-loops-0.4.2.1
but ghc-mod check foo.hs
errors out with:
x.hs:4:8:Could not find module ‘Control.Monad.Loops’Perhaps you meant Control.Monad.Cont (from mtl-2.1.3.1) Control.Monad.List (from mtl-2.1.3.1) Control.Monad.Trans (from mtl-2.1.3.1)Use -v to see a list of the files searched for.
ghc-mod
is located in ~/Library/Haskell/bin and ghc-mod -v
emits:
ghc-mod version 5.0.1.2 compiled by GHC 7.8.3
...
What's kinda odd is that I don't get an error when loading foo.hs
in Emacs under haskell-mode, and presumable that also uses ghc-mod
.
Is there a way to debug this further and/or configure ghc-mod to look in my ~/.ghc directory?
foo.hs
, and runcabal install
, you should be good to go. You'll need to addmonad-loops
as a dependency in the cabal file as well, butcabal init
, which will create a skeleton file for you can sometimes figure this out for you from your code. – bheklilr