atom-haskell-archive / haskell-ghc-mod

haskell-ghc-mod atom package
https://atom.io/packages/haskell-ghc-mod
MIT License
69 stars 20 forks source link

Run ghc-mod from project root directory #235

Closed dspies-leapyear closed 6 years ago

dspies-leapyear commented 6 years ago

I have a stack project with multiple packages each with their own .cabal file and a single stack.yaml in the parent directory. Can I get atom to run ghc-mod from the root directory (which also happens to be the Atom project root directory) rather than from the one where the cabal file is?

lierdakil commented 6 years ago

I'm afraid this won't work as you expect it to. ghc-mod is somewhat dumb when it comes to setups like this, frankly. A simple example:

$ cat stack.yaml
resolver: lts-9.1
packages:
- ghc-mod
$ ls
stack.yaml
ghc-mod/
$ ghc-mod check $PWD/ghc-mod/GhcMod.hs 
ghc-mod/GhcMod.hs:72:1:Failed to load interface for ‘GhcMod.Exe.Boot’Use -v to see a list of the files searched for.
...
ghc-mod/GhcMod.hs:92:1:Failed to load interface for ‘GhcMod.Types’Use -v to see a list of the files searched for.

Reason being, ghc-mod doesn't seem to look for cabalfile in descendant directories, only in parent ones. So... yeah, that's why Atom runs ghc-mod where cabalfile is.

lierdakil commented 6 years ago

Closing. Let me know if there's something to discuss here.