Why suddenly can not find the module?

I have two files in one folder, Eval.hs and Data.hs , the module in Eval.hs imports the Eval.hs module in Data.hs when I try to load Eval.hs interactively (in emacs haskell mode: Ctrl-c, Ctrl l ), he said that he could not find the module defined in Data.hs , but he had successfully loaded earlier, why is it suddenly impossible? By the way, I noticed that the first time I execute Ctrl-c, Ctrl l , an interactive 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. 
+6
source share
4 answers

I sometimes get the same issue with haskell-mode on Emacs. My workaround is

 Prelude> :cd ~/hs/TI Prelude> :load "Eval.hs" 

Now that you want to reload the module, you should use

 Prelude> :r 

instead of Ctrl-C, Ctrl-l.

If anyone knows a better way, please let me know.

-deech

+6
source

Try:

 Prelude> :cd ~/hs Prelude> :load "TI/Eval.hs" 

If the modules really look like Subdirectory.Contains.A , then the working directory should be the Subdirectory directory.

0
source

try adding

 (inferior-haskell-find-project-root nil) 

to your custom set variables. It will no longer be: cd.

a much better solution would be to find out why the function from inf-haskell.el does not quite work

0
source

Just 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 the cabal replacement, which does this for you based on your cabal file.

0
source

Source: https://habr.com/ru/post/890381/


All Articles