DanielG / ghc-mod

Happy Haskell Hacking for editors. DEPRECATED
Other
677 stars 175 forks source link

ghc-mod not detecting user libraries in stack implicit global environment #850

Open SirensOfTitan opened 7 years ago

SirensOfTitan commented 7 years ago

i.e.

stack exec -- ghc-mod check {someFile}

detects globally installed libraries like Test.QuickCheck.Checkers, but

ghc-mod check {someFile}

... does not.

I have no hidden cabal directories between where I'm running things and my home directory. I'm trying to use ghc-mod with the ide-haskell atom package with poor results because of this.

Am I missing something and am just stupid, or should ghc-mod work with implicit global without the stack prefixing?

SirensOfTitan commented 7 years ago

Additional information: ghc-mod debug

ghc-mod: ghc: readCreateProcess: runInteractiveProcess: exec: does not exist (No such file or directory)

ghc-mod --version

ghc-mod version 5.6.0.0 compiled by GHC 8.0.1

stack ghc -- --version

Run from outside a project, using implicit global project config
Using resolver: lts-7.9 from implicit global project's config file: /Users/colep/.stack/global-project/stack.yaml
The Glorious Glasgow Haskell Compilation System, version 8.0.1

stack exec ghc-mod debug

Run from outside a project, using implicit global project config
Using resolver: lts-7.9 from implicit global project's config file: /Users/colep/.stack/global-project/stack.yaml
Version:              ghc-mod-5.6.0.0
Library GHC Version:  8.0.1
System GHC Version:   8.0.1
Root directory:       /Users/colep
Current directory:    /Users/colep
GHC Package flags:
    -i/Users/colep -i/Users/colep -global-package-db -user-package-db
    -Wall
GHC System libraries: /Users/colep/.stack/programs/x86_64-osx/ghc-8.0.1/lib/ghc-8.0.1
DanielG commented 7 years ago

I thought you can make ide-haskell always run ghc-mod via stack exec, what's the problem if that's working?

@lierdakil would know better.

lierdakil commented 7 years ago

I try to avoid running ghc-mod via stack exec for various reasons. Long story short, overall it creates more problems than it solves (primarily related to cabal/stack mixing).

That said, ide-haskell doesn't work all that well without a cabalfile, i.e. without a well-defined project, anyway.

The most straightforward band-aid at this point would be to just run Atom via stack exec atom or something similar.

DanielG commented 7 years ago

Have you tried the stack exec ghc-mod route recently, i.e. since 5.6 since I made the stack detection a whole lot more robust if you haven't seen it: https://github.com/DanielG/ghc-mod/commit/2f31cf431a9ea5659a0a19b672c6bb7dcceaca50

lierdakil commented 7 years ago

Yeah, I've seen it, but apparently forgot about that. Problem is, stack exec ghc-mod will always use stack. Which means I have to decide if it's a stack project before invoking ghc-mod. Which I will probably just make user choose, eventually. But until then I'm relying on ghc-mod's autodetection.

lierdakil commented 7 years ago

Also, I do have to support ghc-mod-5.5, since 5.6 isn't in stack's lts-6.* (ghc 7.10 branch), and ghc 8.0 has some problems.