2

I'm in a ghci session trying to load a Main.hs file I've been working on. It looks like I'm in the right directory in that I can see the file:

ghci    λ> :cd /home/username/codeplace
ghci    λ> :! ls
lib.hs        Main.hs          

But I can't seem to load it:

ghci    λ> :load Main
*** Exception: code: changeWorkingDirectory: does not exist (No such file or directory)

Well that's a weird error. Same for any :l variation I can think of:

ghci    λ> :l Main
*** Exception: code: changeWorkingDirectory: does not exist (No such file or directory)
ghci    λ> :l Main.hs
*** Exception: code: changeWorkingDirectory: does not exist (No such file or directory)
ghci    λ> :l 'Main.hs'
target ‘'Main.hs'’ is not a module name or a source file
ghci    λ> :l "Main.hs"
*** Exception: code: changeWorkingDirectory: does not exist (No such file or directory)
ghci    λ> :l ./Main.hs
*** Exception: code: changeWorkingDirectory: does not exist (No such file or directory)

According to reference docs here, it should just be

:load Main

Right?

Some potential sources of weirdness that may help a haskell wizard see the error of my ways:

  • I'm running my ghci in an emacs session using intero.
  • I have a custom prompt in ~/.ghc/ghci.conf

eg:

  :set prompt "ghci    λ> "
  :set +m
  :set prompt2 "ghci     | "

Why can't I load, why am I getting this strange error about changing directories, and how can I fix?

Drew
  • 29,895
  • 7
  • 74
  • 104
Mittenchops
  • 18,633
  • 33
  • 128
  • 246
  • 1
    Very strange error indeed... can you run `ghci --ignore-dot-ghci` from a regular terminal and see if it works then, to eliminate the possibility that your configuration (either .ghci and emacs configuration) are causing it? I can't imagine how it could be the `.ghci` file, but emacs/intero could certainly be doing very very weird things. (was going to try intero myself, but it doesn't even install....) – user2407038 Feb 18 '17 at 06:46
  • If this doesn't reveal the cause of the error, then you should also try `ghci -v4` (verbosity) and include the output from that as well. – user2407038 Feb 18 '17 at 07:08
  • Smell like `corrupted file` or file/directory `permission` problem to me. – wizzup Feb 18 '17 at 09:06
  • Can you show the contents of main? – epsilonhalbe Feb 18 '17 at 11:07
  • I had the same error a few times while running ghc provided by stack outside a stack sandbox. – vek Feb 20 '17 at 15:07

1 Answers1

0

Hmm, I can't provide additional information as to what was happening. Went to answer comments above after rebooting the next day and everything worked fine. Strange.

Mittenchops
  • 18,633
  • 33
  • 128
  • 246