I have two files in the same folder, Eval.hs
and Data.hs
, module in开发者_开发百科 Eval.hs
imports module TI.Data
in Data.hs
, when I try to load Eval.hs
in the interactive (in emacs haskell mode: Ctrl-c, Ctrl l
), it said it can't find the module defined in Data.hs
, but it loaded successfully before, why suddenly it can't??
btw, I noticed that the first time I execute Ctrl-c, Ctrl l
, the interative window:
GHCi, version 6.12.1: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :cd ~/.cabal/
Prelude> :load "../hs/TI/Eval.hs"
../hs/TI/Eval.hs:2:7:
Could not find module `TI.Data':
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
I sometimes have this same problem with haskell-mode on Emacs. My workaround is to
Prelude> :cd ~/hs/TI
Prelude> :load "Eval.hs"
Now when you want to reload the module you have to use
Prelude> :r
instead of Ctrl-C, Ctrl-l.
If someone knows a better way, please let me know.
-deech
Try:
Prelude> :cd ~/hs
Prelude> :load "TI/Eval.hs"
If the modules are actually like Subdirectory.Contains.A
then the working directory needs to be the directory Subdirectory
.
try adding
(inferior-haskell-find-project-root nil)
to your custom set variables. It will no longer :cd.
a much better solution would be finding out why the function in inf-haskell.el
doesn't quite work
Simply run
:set -isrc -imyothersrcdir
To add any source directories. You can put this line in a .ghci file in the directory from which you run GHCi.
Alternatively just use cabal repl which does this for you based on your cabal file.
精彩评论