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

Stack integration still requires `stack exec atom` #119

Closed elldritch closed 8 years ago

elldritch commented 8 years ago

Running haskell-ghc-mod 1.6.6, I still need to invoke Atom via stack exec atom in order to use ghc-mod check or ghc-mod type. Otherwise, ghc-mod fails with <some package>-<version>-<hash> is unusable due to missing or recursive dependencies: <packages here> (use -v for more information). I'm guessing this is because Stack does some extra magic behind the scenes that allows ghc-mod to read its packages.

lierdakil commented 8 years ago

This should not be the case. My guess is you need to run stack build before ghc-mod can pick up your project. Either that, or you have multiple versions of ghc-mod installed and those conflict with each other.

elldritch commented 8 years ago

Running stack build doesn't help. Opening up the developer console shows that ghc-mod fails because a package's dependencies cannot be resolved due to recursive or missing dependencies. I'm guessing that ghc-mod is somehow not detecting that I'm using Stack.

lierdakil commented 8 years ago

Okay. Here are some troubleshooting suggestions:

  1. Make sure you don't have dist/setup-config file in project directory (this will make ghc-mod default to cabal). Make sure you have stack.yaml in your project directory (obviously)
  2. Run ghc-mod in your project directory directly. You can do something like ghc-mod check main-file.hs for testing purposes. Read output.
  3. Testing for any rouge ghc-mod installations, if you're on POSIX (Linux or Mac), run which ghc-mod and stack exec which ghc-mod in your project directory. If you're on Windows, run where ghc-mod and stack exec where ghc-mod in your project directory. Compare output.

Please let me know if you figure something out.

elldritch commented 8 years ago

Using ghc-mod check <file> fails for me with the dependency error, but stack exec ghc-mod check <file> succeeds with no output. Ghc-mod is installed using Stack (which ghc-mod evaluates to /home/leo/.local/bin/ghc-mod).

stack exec which ghc-mod gives a different output (/home/leo/.stack/snapshots/x86_64-linux/lts-5.4/7.10.3/bin/ghc-mod), but I installed ghc-mod with stack install ghc-mod globally using the lts-5.4 resolver and the binary copied to .local/bin is the same one in the lts-5.4 snapshot. Are there any environmental variables which stack exec sets that aren't being set when Atom is invoked outside of Stack?

DanielG commented 8 years ago

Are you absolutely positive those two executable are identical? (I'd compare their hashes or something) Anyways ghc-mod debug and stack exec ghc-mod debug should help spotting the difference either way so please post both.

elldritch commented 8 years ago

Yes, they have identical MD5 hashes. When I diff the debug commands, it seems stack exec ghc-mod debug is prepending <path to project>/.stack-work/install/x86_64-linux/lts-5.4/7.10.3/bin and /home/leo/.stack/snapshots/x86_64-linux/lts-5.4/7.10.3/bin to seBinPath in the StackEnv record of StackProject.

The snapshots folder only has the executable of my project and the snapshots folder contains ghc-mod and ghc-modi (which still have the same hash as the result of which ghc-mod and which ghc-modi).

DanielG commented 8 years ago

Can you post the complete output of the two commands too please.

elldritch commented 8 years ago

In order to avoid getting the error cabal: At least the following dependencies are missing: ..., I'm configuring using cabal configure --package-db=clear --package-db=global --package-db=$(stack path --snapshot-pkg-db) --package-db=$(stack path --local-pkg-db). Is this part of the problem?

ghc-mod debug output:

Root directory:       /home/leo/Documents/Development/active/opthrift/bot-haskell
Current directory:    /home/leo/Documents/Development/active/opthrift/bot-haskell
GHC Package flags:
    -fbuilding-cabal-package -O -outputdir dist/build -odir dist/build
    -hidir dist/build -stubdir dist/build -i -idist/build -isrc
    -idist/build/autogen -Idist/build/autogen -Idist/build
    -optP-include -optPdist/build/autogen/cabal_macros.h
    -hide-all-packages -no-user-package-db -package-db
    /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
    -package-db
    /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
    -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
    -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
    -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
    wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
    websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
GHC System libraries: /home/leo/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3
GHC user options:

Cabal file:           Just "/home/leo/Documents/Development/active/opthrift/bot-haskell/operator.cabal"
Project:   CabalProject
Cabal entrypoints:
    Setup.hs
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/Setup.hs)
    library
        Lib (/home/leo/Documents/Development/active/opthrift/bot-haskell/src/Lib.hs)
    exe:operator
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/app/Main.hs)
Cabal components:
    Setup.hs
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/Setup.hs)
    library
        Lib (/home/leo/Documents/Development/active/opthrift/bot-haskell/src/Lib.hs)
    exe:operator
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/app/Main.hs)
GHC Cabal options:
    Setup.hs
    library
        -fbuilding-cabal-package -O -outputdir dist/build -odir dist/build
        -hidir dist/build -stubdir dist/build -i -idist/build -isrc
        -idist/build/autogen -Idist/build/autogen -Idist/build
        -optP-include -optPdist/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-db
        /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
        -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
        wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
        websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
    exe:operator
        -fbuilding-cabal-package -O -outputdir dist/build -odir dist/build
        -hidir dist/build -stubdir dist/build -i
        -idist/build/operator/operator-tmp -iapp -idist/build -isrc
        -idist/build/autogen -Idist/build/operator/operator-tmp
        -Idist/build/autogen -Idist/build -optP-include
        -optPdist/build/autogen/cabal_macros.h -hide-all-packages
        -no-user-package-db -package-db
        /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-db
        /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
        -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
        wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
        websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
        -threaded -rtsopts -with-rtsopts=-N
GHC search path options:
    Setup.hs
    library
        -i -idist/build -isrc -idist/build/autogen -Idist/build/autogen
        -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h
    exe:operator
        -i -idist/build/operator/operator-tmp -iapp -idist/build/autogen
        -Idist/build/autogen -Idist/build/operator/operator-tmp
        -optP-include -optPdist/build/autogen/cabal_macros.h

stack exec ghc-mod debug output:

Root directory:       /home/leo/Documents/Development/active/opthrift/bot-haskell
Current directory:    /home/leo/Documents/Development/active/opthrift/bot-haskell
GHC Package flags:
    -fbuilding-cabal-package -O -outputdir dist/build -odir dist/build
    -hidir dist/build -stubdir dist/build -i -idist/build -isrc
    -idist/build/autogen -Idist/build/autogen -Idist/build
    -optP-include -optPdist/build/autogen/cabal_macros.h
    -hide-all-packages -no-user-package-db -package-db
    /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
    -package-db
    /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
    -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
    -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
    -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
    wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
    websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
GHC System libraries: /home/leo/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3
GHC user options:

Cabal file:           Just "/home/leo/Documents/Development/active/opthrift/bot-haskell/operator.cabal"
Project:   CabalProject
Cabal entrypoints:
    Setup.hs
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/Setup.hs)
    library
        Lib (/home/leo/Documents/Development/active/opthrift/bot-haskell/src/Lib.hs)
    exe:operator
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/app/Main.hs)
Cabal components:
    Setup.hs
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/Setup.hs)
    library
        Lib (/home/leo/Documents/Development/active/opthrift/bot-haskell/src/Lib.hs)
    exe:operator
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/app/Main.hs)
GHC Cabal options:
    Setup.hs
    library
        -fbuilding-cabal-package -O -outputdir dist/build -odir dist/build
        -hidir dist/build -stubdir dist/build -i -idist/build -isrc
        -idist/build/autogen -Idist/build/autogen -Idist/build
        -optP-include -optPdist/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-db
        /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
        -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
        wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
        websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
    exe:operator
        -fbuilding-cabal-package -O -outputdir dist/build -odir dist/build
        -hidir dist/build -stubdir dist/build -i
        -idist/build/operator/operator-tmp -iapp -idist/build -isrc
        -idist/build/autogen -Idist/build/operator/operator-tmp
        -Idist/build/autogen -Idist/build -optP-include
        -optPdist/build/autogen/cabal_macros.h -hide-all-packages
        -no-user-package-db -package-db
        /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-db
        /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
        -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
        wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
        websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
        -threaded -rtsopts -with-rtsopts=-N
GHC search path options:
    Setup.hs
    library
        -i -idist/build -isrc -idist/build/autogen -Idist/build/autogen
        -Idist/build -optP-include -optPdist/build/autogen/cabal_macros.h
    exe:operator
        -i -idist/build/operator/operator-tmp -iapp -idist/build/autogen
        -Idist/build/autogen -Idist/build/operator/operator-tmp
        -optP-include -optPdist/build/autogen/cabal_macros.h
DanielG commented 8 years ago

Interesting, I can't find a single difference in those two logs. However just as I suspected ghc-mod is not recognizing your project to be a stack project. See the Project: CabalProject field in the output, that should say StackProject {...}.

Oh I just realized. Of course the configure command is interfering since that forces ghc-mod into cabal project mode since it creates dist/setup-config. So you're getting that At least the following dependencies are missing error even just with the debug command?

elldritch commented 8 years ago

No, the debug command works fine. Interestingly, rm -r dist causes stack exec ghc-mod check <file> to work fine, but ghc-mod check <file> fails with <package> is unusable due to missing or recursive dependencies.

After running rm -r dist:

stack exec atom . still works (ghc-mod will show me type info) and atom . still doesn't work (ghc-mod shows me an error occurred with the backend).

ghc-mod debug output:

Root directory:       /home/leo/Documents/Development/active/opthrift/bot-haskell
Current directory:    /home/leo/Documents/Development/active/opthrift/bot-haskell
GHC Package flags:
    -fbuilding-cabal-package -O -outputdir
    .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -odir
    .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -hidir
    .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -stubdir
    .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i
    -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -isrc
    -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
    -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
    -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
    -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
    -hide-all-packages -no-user-package-db -package-db
    /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
    -package-db
    /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
    -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
    -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
    -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
    wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
    websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
GHC System libraries: /home/leo/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3
GHC user options:

Stack ghc executable:    Just "/opt/ghc/7.10.3/bin/ghc"
Stack ghc-pkg executable:Just "/opt/ghc/7.10.3/bin/ghc-pkg"
Cabal file:           Just "/home/leo/Documents/Development/active/opthrift/bot-haskell/operator.cabal"
Project:   StackProject (StackEnv {seDistDir = ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0", seBinPath = ["/home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/bin","/home/leo/.rvm/gems/ruby-2.2.1/bin","/home/leo/.rvm/gems/ruby-2.2.1@global/bin","/home/leo/.rvm/rubies/ruby-2.2.1/bin","/home/leo/.rvm/bin","/home/leo/.golang/bin","/home/leo/.local/bin","/home/leo/.cabal/bin","/opt/ghc/7.10.3/bin","/usr/lib/dart/bin","/home/leo/.npm-g/bin","/home/leo/.nvm/versions/node/v5.7.1/bin","/home/leo/.nix-profile/bin","/home/leo/.nix-profile/sbin","/usr/local/heroku/bin","/home/leo/Scripts","/usr/local/sbin","/usr/local/bin","/usr/sbin","/usr/bin","/sbin","/bin","/usr/games","/usr/local/sbin","/usr/local/bin","/usr/sbin","/usr/bin","/sbin","/bin","/usr/games","/usr/local/games"], seSnapshotPkgDb = "/home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb", seLocalPkgDb = "/home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb"})
Cabal entrypoints:
    Setup.hs
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/Setup.hs)
    library
        Lib (/home/leo/Documents/Development/active/opthrift/bot-haskell/src/Lib.hs)
    exe:operator
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/app/Main.hs)
    test:operator-test
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/test/Spec.hs)
Cabal components:
    Setup.hs
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/Setup.hs)
    library
        Lib (/home/leo/Documents/Development/active/opthrift/bot-haskell/src/Lib.hs)
    exe:operator
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/app/Main.hs)
    test:operator-test
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/test/Spec.hs)
GHC Cabal options:
    Setup.hs
    library
        -fbuilding-cabal-package -O -outputdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -odir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -hidir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -stubdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-db
        /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
        -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
        wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
        websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
    exe:operator
        -fbuilding-cabal-package -O -outputdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -odir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -hidir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -stubdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp
        -iapp -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-db
        /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
        -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
        wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
        websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
        -threaded -rtsopts -with-rtsopts=-N
    test:operator-test
        -fbuilding-cabal-package -O -outputdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -odir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -hidir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -stubdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp
        -itest -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-db
        /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
        -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
        wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
        websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
        -threaded -rtsopts -with-rtsopts=-N
GHC search path options:
    Setup.hs
    library
        -i -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
    exe:operator
        -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp
        -iapp -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp
        -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
    test:operator-test
        -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp
        -itest -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp
        -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h

stack exec ghc-mod debug output:

Root directory:       /home/leo/Documents/Development/active/opthrift/bot-haskell
Current directory:    /home/leo/Documents/Development/active/opthrift/bot-haskell
GHC Package flags:
    -fbuilding-cabal-package -O -outputdir
    .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -odir
    .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -hidir
    .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -stubdir
    .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i
    -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -isrc
    -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
    -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
    -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
    -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
    -hide-all-packages -no-user-package-db -package-db
    /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
    -package-db
    /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
    -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
    -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
    -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
    wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
    websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
GHC System libraries: /home/leo/.stack/programs/x86_64-linux/ghc-7.10.3/lib/ghc-7.10.3
GHC user options:

Stack ghc executable:    Just "/opt/ghc/7.10.3/bin/ghc"
Stack ghc-pkg executable:Just "/opt/ghc/7.10.3/bin/ghc-pkg"
Cabal file:           Just "/home/leo/Documents/Development/active/opthrift/bot-haskell/operator.cabal"
Project:   StackProject (StackEnv {seDistDir = ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0", seBinPath = ["/home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/bin","/home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/bin","/home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/bin","/home/leo/.rvm/gems/ruby-2.2.1/bin","/home/leo/.rvm/gems/ruby-2.2.1@global/bin","/home/leo/.rvm/rubies/ruby-2.2.1/bin","/home/leo/.rvm/bin","/home/leo/.golang/bin","/home/leo/.local/bin","/home/leo/.cabal/bin","/opt/ghc/7.10.3/bin","/usr/lib/dart/bin","/home/leo/.npm-g/bin","/home/leo/.nvm/versions/node/v5.7.1/bin","/home/leo/.nix-profile/bin","/home/leo/.nix-profile/sbin","/usr/local/heroku/bin","/home/leo/Scripts","/usr/local/sbin","/usr/local/bin","/usr/sbin","/usr/bin","/sbin","/bin","/usr/games","/usr/local/sbin","/usr/local/bin","/usr/sbin","/usr/bin","/sbin","/bin","/usr/games","/usr/local/games"], seSnapshotPkgDb = "/home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb", seLocalPkgDb = "/home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb"})
Cabal entrypoints:
    Setup.hs
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/Setup.hs)
    library
        Lib (/home/leo/Documents/Development/active/opthrift/bot-haskell/src/Lib.hs)
    exe:operator
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/app/Main.hs)
    test:operator-test
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/test/Spec.hs)
Cabal components:
    Setup.hs
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/Setup.hs)
    library
        Lib (/home/leo/Documents/Development/active/opthrift/bot-haskell/src/Lib.hs)
    exe:operator
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/app/Main.hs)
    test:operator-test
        Main (/home/leo/Documents/Development/active/opthrift/bot-haskell/test/Spec.hs)
GHC Cabal options:
    Setup.hs
    library
        -fbuilding-cabal-package -O -outputdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -odir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -hidir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -stubdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-db
        /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
        -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
        wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
        websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
    exe:operator
        -fbuilding-cabal-package -O -outputdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -odir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -hidir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -stubdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp
        -iapp -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-db
        /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
        -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
        wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
        websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
        -threaded -rtsopts -with-rtsopts=-N
    test:operator-test
        -fbuilding-cabal-package -O -outputdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -odir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -hidir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -stubdir
        .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp
        -itest -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-db
        /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb
        -package-id base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d
        -package-id scotty-0.10.2-7a54656b519d424e7056839164fd244b
        -package-id wai-3.2.0-881c4cc8c44052f9133e13940117e71a -package-id
        wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3 -package-id
        websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6 -XHaskell2010
        -threaded -rtsopts -with-rtsopts=-N
GHC search path options:
    Setup.hs
    library
        -i -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
    exe:operator
        -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp
        -iapp -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp
        -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
    test:operator-test
        -i
        -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp
        -itest -i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp
        -optP-include
        -optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h
DanielG commented 8 years ago

Alright we're getting somewhere. You're getting Project: StackProject ... in both cases now. So my guess is there is something going wrong in cabal-helper or something. I'll need ghc-pkg list, cabal --version and ghc-mod check -vvv <whatever> oh and you haven't mentioned the version of ghc-mod yet I think so ghc-mod --version too. (In case it's less than 5.5.0.0 you might have to use -v7 instead of -vvv we changed that some time ago.)

callmeyesh commented 8 years ago

I am having the exact same problem and here is the info you requested.

ghc-pkg list

WARNING: cache is out of date: /usr/local/Cellar/ghc/7.10.3b/lib/ghc-7.10.3/package.conf.d/package.cache
ghc will see an old view of this package db. Use 'ghc-pkg recache' to fix.
/usr/local/Cellar/ghc/7.10.3b/lib/ghc-7.10.3/package.conf.d
   Cabal-1.22.5.0
   array-0.5.1.0
   base-4.8.2.0
   bin-package-db-0.0.0.0
   binary-0.7.5.0
   bytestring-0.10.6.0
   containers-0.5.6.2
   deepseq-1.4.1.1
   directory-1.2.2.0
   filepath-1.4.0.0
   ghc-7.10.3
   ghc-prim-0.4.0.0
   haskeline-0.7.2.1
   hoopl-3.10.0.2
   hpc-0.6.0.2
   integer-gmp-1.0.0.0
   pretty-1.1.2.0
   process-1.2.3.0
   rts-1.0
   template-haskell-2.10.0.0
   terminfo-0.4.0.1
   time-1.5.0.1
   transformers-0.4.2.0
   unix-2.7.1.0
   xhtml-3000.2.1
/Users/yvenkatesh/.ghc/x86_64-darwin-7.10.3/package.conf.d
   aeson-0.11.0.0
   argparser-0.3.4
   asn1-encoding-0.9.3
   asn1-parse-0.9.4
   asn1-types-0.3.2
   async-2.1.0
   attoparsec-0.13.0.1
   base64-bytestring-1.0.0.1
   blaze-builder-0.4.0.1
   byteable-0.1.1
   case-insensitive-1.2.0.5
   cereal-0.5.1.0
   conduit-1.2.6.2
   connection-0.2.5
   cookie-0.4.1.6
   cryptonite-0.13
   data-default-class-0.0.1
   dlist-0.7.1.2
   exceptions-0.8.2.1
   fail-4.9.0.0
   hashable-1.2.4.0
   hasktags-0.69.1
   hourglass-0.2.9
   http-client-0.4.27
   http-client-tls-0.2.2
   http-conduit-2.1.8
   http-types-0.9
   json-0.9.1
   lifted-base-0.2.3.6
   memory-0.11
   mime-types-0.1.0.6
   mmorph-1.0.6
   monad-control-1.0.0.5
   mtl-2.2.1
   my-project-0.1.0.0
   network-2.6.2.1
   network-uri-2.6.0.3
   old-locale-1.0.0.7
   parsec-3.1.9
   pem-0.2.2
   primitive-0.6.1.0
   random-1.1
   resourcet-1.1.7.2
   scientific-0.3.4.4
   semigroups-0.18.1
   socks-0.5.4
   split-0.2.3
   stm-2.4.4.1
   streaming-commons-0.1.15.1
   syb-0.6
   tagged-0.8.3
   text-1.2.2.0
   tls-1.3.4
   transformers-base-0.4.4
   transformers-compat-0.5.1.4
   unordered-containers-0.2.7.0
   utf8-string-1.0.1.1
   vector-0.11.0.0
   x509-1.6.3
   x509-store-1.6.1
   x509-system-1.6.3
   x509-validation-1.6.3
   zlib-0.6.1.1
cabal --version
cabal-install version 1.22.9.0
using version 1.22.8.0 of the Cabal library
ghc-mod --version
ghc-mod version 5.5.0.0 compiled by GHC 7.10.3
lierdakil commented 8 years ago

Do please also run ghc-mod check -v 7 Main.hs (or not Main.hs, but other file, you get the idea)

DanielG commented 8 years ago

@callmeyesh Also ghc-mod debug in both cases, same as above.

callmeyesh commented 8 years ago

I ran ghc-mod check app/Main.hs -v and it didn't throw any output.

ghc-mod debug
helloworld-0.1.0.0: configure
Configuring helloworld-0.1.0.0...
Root directory:       /Users/yvenkatesh/Documents/Haskell/helloworld
Current directory:    /Users/yvenkatesh/Documents/Haskell/helloworld
GHC Package flags:
    -fbuilding-cabal-package -O -outputdir
    .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -odir
    .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -hidir
    .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -stubdir
    .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -i
    -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -isrc
    -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
    -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
    -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -optP-include
    -optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h
    -hide-all-packages -no-user-package-db -package-db
    /Users/yvenkatesh/.stack/snapshots/x86_64-osx/lts-5.8/7.10.3/pkgdb
    -package-db
    /Users/yvenkatesh/Documents/Haskell/helloworld/.stack-work/install/x86_64-osx/lts-5.8/7.10.3/pkgdb
    -package-id base-4.8.2.0-bfcc6de9ee2962ae54db40ece3022dc5
    -XHaskell2010
GHC System libraries: /usr/local/Cellar/ghc/7.10.3b/lib/ghc-7.10.3
GHC user options:

Stack ghc executable:    Just "/usr/local/bin/ghc"
Stack ghc-pkg executable:Just "/usr/local/bin/ghc-pkg"
Cabal file:           Just "/Users/yvenkatesh/Documents/Haskell/helloworld/helloworld.cabal"
Project:   StackProject (StackEnv {seDistDir = ".stack-work/dist/x86_64-osx/Cabal-1.22.5.0", seBinPath = ["/Users/yvenkatesh/.stack/snapshots/x86_64-osx/lts-5.8/7.10.3/bin","/usr/local/bin","/usr/local/sbin","/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home","/usr/local/Cellar/maven/3.2.5/libexec/bin","/usr/local/opt/rbenv/shims","/usr/local/opt/rbenv/bin","/usr/local/bin","/usr/bin","/bin","/usr/sbin","/sbin","/opt/X11/bin","/usr/local/go/bin","/Users/yvenkatesh/go/bin","/Users/yvenkatesh/.local/bin"], seSnapshotPkgDb = "/Users/yvenkatesh/.stack/snapshots/x86_64-osx/lts-5.8/7.10.3/pkgdb", seLocalPkgDb = "/Users/yvenkatesh/Documents/Haskell/helloworld/.stack-work/install/x86_64-osx/lts-5.8/7.10.3/pkgdb"})
Cabal entrypoints:
    Setup.hs
        Main (/Users/yvenkatesh/Documents/Haskell/helloworld/Setup.hs)
    library
        Lib (/Users/yvenkatesh/Documents/Haskell/helloworld/src/Lib.hs)
    exe:helloworld-exe
        Main (/Users/yvenkatesh/Documents/Haskell/helloworld/app/Main.hs)
    test:helloworld-test
        Main (/Users/yvenkatesh/Documents/Haskell/helloworld/test/Spec.hs)
Cabal components:
    Setup.hs
        Main (/Users/yvenkatesh/Documents/Haskell/helloworld/Setup.hs)
    library
        Lib (/Users/yvenkatesh/Documents/Haskell/helloworld/src/Lib.hs)
    exe:helloworld-exe
        Main (/Users/yvenkatesh/Documents/Haskell/helloworld/app/Main.hs)
    test:helloworld-test
        Main (/Users/yvenkatesh/Documents/Haskell/helloworld/test/Spec.hs)
GHC Cabal options:
    Setup.hs
    library
        -fbuilding-cabal-package -O -outputdir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -odir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -hidir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -stubdir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -i
        -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /Users/yvenkatesh/.stack/snapshots/x86_64-osx/lts-5.8/7.10.3/pkgdb
        -package-db
        /Users/yvenkatesh/Documents/Haskell/helloworld/.stack-work/install/x86_64-osx/lts-5.8/7.10.3/pkgdb
        -package-id base-4.8.2.0-bfcc6de9ee2962ae54db40ece3022dc5
        -XHaskell2010
    exe:helloworld-exe
        -fbuilding-cabal-package -O -outputdir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -odir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -hidir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -stubdir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -i
        -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp
        -iapp -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /Users/yvenkatesh/.stack/snapshots/x86_64-osx/lts-5.8/7.10.3/pkgdb
        -package-db
        /Users/yvenkatesh/Documents/Haskell/helloworld/.stack-work/install/x86_64-osx/lts-5.8/7.10.3/pkgdb
        -package-id base-4.8.2.0-bfcc6de9ee2962ae54db40ece3022dc5
        -XHaskell2010 -threaded -rtsopts -with-rtsopts=-N
    test:helloworld-test
        -fbuilding-cabal-package -O -outputdir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -odir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -hidir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -stubdir
        .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -i
        -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-test/helloworld-test-tmp
        -itest -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-test/helloworld-test-tmp
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h
        -hide-all-packages -no-user-package-db -package-db
        /Users/yvenkatesh/.stack/snapshots/x86_64-osx/lts-5.8/7.10.3/pkgdb
        -package-db
        /Users/yvenkatesh/Documents/Haskell/helloworld/.stack-work/install/x86_64-osx/lts-5.8/7.10.3/pkgdb
        -package-id base-4.8.2.0-bfcc6de9ee2962ae54db40ece3022dc5
        -XHaskell2010 -threaded -rtsopts -with-rtsopts=-N
GHC search path options:
    Setup.hs
    library
        -i -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -isrc
        -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build -optP-include
        -optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h
    exe:helloworld-exe
        -i
        -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp
        -iapp -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp
        -optP-include
        -optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h
    test:helloworld-test
        -i
        -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-test/helloworld-test-tmp
        -itest -i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen
        -I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-test/helloworld-test-tmp
        -optP-include
        -optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h
lierdakil commented 8 years ago

@callmeyesh oops, sorry, my bad. ghc-mod --verbose 7 check your-file.hs. Just -v doesn't show everything.

DanielG commented 8 years ago

@callmeyesh You should be getting some error at least, no? If not then what's the problem anyways :p Also please do it both with and without stack exec at the front. The whole point of this exercise is to spot the difference that invoking ghc-mod via stack exec makes vs. a normal run.

callmeyesh commented 8 years ago
ghc-mod --verbose 7 check app/Main.hs
DEBUG: reading cache: /Users/yvenkatesh/Documents/Haskell/helloworld/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/setup-config.ghc-mod.cabal-components
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build","-isrc","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp","-iapp","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-test/helloworld-test-tmp","-itest","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-test/helloworld-test-tmp","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint: []
DEBUG: making sure autogen files exist
DEBUG: reading cache: .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/setup-config.ghc-mod.resolved-components
VOMIT: Initializing GHC session with following options: "-fbuilding-cabal-package" "-O" "-outputdir" ".stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-odir" ".stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-hidir" ".stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-stubdir" ".stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-i" "-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp" "-iapp" "-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-isrc" "-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen" "-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp" "-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen" "-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-optP-include" "-optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h" "-hide-all-packages" "-no-user-package-db" "-package-db" "/Users/yvenkatesh/.stack/snapshots/x86_64-osx/lts-5.8/7.10.3/pkgdb" "-package-db" "/Users/yvenkatesh/Documents/Haskell/helloworld/.stack-work/install/x86_64-osx/lts-5.8/7.10.3/pkgdb" "-package-id" "base-4.8.2.0-bfcc6de9ee2962ae54db40ece3022dc5" "-XHaskell2010" "-threaded" "-rtsopts" "-with-rtsopts=-N" "-O0"
DEBUG: initSession: Session not initialized, creating new one
DEBUG: loadTargets: Loading: app/Main.hs
DEBUG: loadTargets: Loading done
stack exec ghc-mod --verbose 7 check app/Main.hs
Version 1.0.4 x86_64
2016-03-16 17:37:41.613226: [debug] Checking for project config at: /Users/yvenkatesh/Documents/Haskell/helloworld/stack.yaml @(stack_4dvKIEntzDN7ESZC7K4r0G:Stack.Config src/Stack/Config.hs:761:9)
2016-03-16 17:37:41.615906: [debug] Loading project config file stack.yaml @(stack_4dvKIEntzDN7ESZC7K4r0G:Stack.Config src/Stack/Config.hs:779:13)
2016-03-16 17:37:41.616962: [debug] Trying to decode /Users/yvenkatesh/.stack/build-plan-cache/x86_64-osx/lts-5.8.cache @(stack_4dvKIEntzDN7ESZC7K4r0G:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:55:5)
2016-03-16 17:37:41.630078: [debug] Success decoding /Users/yvenkatesh/.stack/build-plan-cache/x86_64-osx/lts-5.8.cache @(stack_4dvKIEntzDN7ESZC7K4r0G:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:64:13)
2016-03-16 17:37:41.630172: [debug] Trying to decode /Users/yvenkatesh/.stack/indices/Hackage/00-index.cache @(stack_4dvKIEntzDN7ESZC7K4r0G:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:55:5)
2016-03-16 17:37:41.863293: [debug] Success decoding /Users/yvenkatesh/.stack/indices/Hackage/00-index.cache @(stack_4dvKIEntzDN7ESZC7K4r0G:Data.Binary.VersionTagged src/Data/Binary/VersionTagged.hs:64:13)
2016-03-16 17:37:41.872790: [debug] Run process: ghc --info @(stack_4dvKIEntzDN7ESZC7K4r0G:System.Process.Read src/System/Process/Read.hs:269:3)
2016-03-16 17:37:41.940807: [debug] Run process: ghc --numeric-version @(stack_4dvKIEntzDN7ESZC7K4r0G:System.Process.Read src/System/Process/Read.hs:269:3)
2016-03-16 17:37:41.993577: [debug] Run process: ghc-pkg --no-user-package-db field --simple-output Cabal version @(stack_4dvKIEntzDN7ESZC7K4r0G:System.Process.Read src/System/Process/Read.hs:269:3)
2016-03-16 17:37:42.053696: [debug] Run process: ghc-pkg --no-user-package-db list --global @(stack_4dvKIEntzDN7ESZC7K4r0G:System.Process.Read src/System/Process/Read.hs:269:3)
2016-03-16 17:37:42.113691: [debug] Run process: ghc-mod 7 check app/Main.hs @(stack_4dvKIEntzDN7ESZC7K4r0G:Stack.Exec src/Stack/Exec.hs:51:5)
callmeyesh commented 8 years ago

Sorry about that guys. @DanielG There is no error being thrown from the command line, I just created this test project using

stack new helloworld new-template

Then added the project folder into atom and I get the following error

caps: {"version":[5,5,0,0],"legacyInteractive":true,"fileMap":true,"rootExec":false,"quoteArgs":true,"optparse":true} URI: /Users/yvenkatesh/Documents/Haskell/helloworld/app/Main.hs Args: -- message: ghc-mod: cabal: readCreateProcess: runInteractiveProcess: exec: does not exist (No such file or directory) log: -0.042s: running /Users/yvenkatesh/.local/bin/ghc-mod check,/Users/yvenkatesh/Documents/Haskell/helloworld/app/Main.hs,-- with options.cwd = /Users/yvenkatesh/Documents/Haskell/helloworld,options.env = [object Object],options.encoding = utf-8 -0.03s: running /Users/yvenkatesh/.local/bin/ghc-mod lint,/Users/yvenkatesh/Documents/Haskell/helloworld/app/Main.hs,-- with options.cwd = /Users/yvenkatesh/Documents/Haskell/helloworld,options.env = [object Object],options.encoding = utf-8 -0.026s: Main did-save triggered -0.026s: Main updating -0.025s: running /Users/yvenkatesh/.local/bin/ghc-mod browse,-d,--,Main with options.cwd = /Users/yvenkatesh/Documents/Haskell/helloworld,options.env = [object Object],options.encoding = utf-8 -0.001s: ghc-mod said: ghc-mod: cabal: readCreateProcess: runInteractiveProcess: exec: does not exist (No such file or directory) 0s: /Users/yvenkatesh/.local/bin/ghc-mod ended with code 1 0s: code 1: ghc-mod: cabal: readCreateProcess: runInteractiveProcess: exec: does not exist (No such file or directory)

Stack trace

code 1: ghc-mod: cabal: readCreateProcess: runInteractiveProcess: exec: does not exist (No such file or directory) at module.exports.Util.mkError (/Users/yvenkatesh/.atom/packages/haskell-ghc-mod/lib/util.coffee:154:15) at BufferedProcess.exit (/Users/yvenkatesh/.atom/packages/haskell-ghc-mod/lib/ghc-mod/ghc-modi-process-real.coffee:122:20) at triggerExitCallback (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:213:47) at /Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:220:18 at Socket.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:98:18) at emitOne (events.js:82:20) at Socket.emit (events.js:169:7) at Pipe._onclose (net.js:469:12)

DanielG commented 8 years ago

In the second case you have to make stack stop parsing commandline arguments using --: stack exec -- ghc-mod --verbose 7 check app/Main.hs.

@lierdakil any idea what atom could do differently then? I mean it probably uses legacy-interactive rather than the single shot commands and that difference does often cause problems but I'm hoping it's not that since it's a complete nightmare to test that by hand.

callmeyesh commented 8 years ago
stack exec -- ghc-mod --verbose 7 check app/Main.hs
DEBUG: reading cache: /Users/yvenkatesh/Documents/Haskell/helloworld/.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/setup-config.ghc-mod.cabal-components
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build","-isrc","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp","-iapp","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-test/helloworld-test-tmp","-itest","-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-test/helloworld-test-tmp","-optP-include","-optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint: []
DEBUG: making sure autogen files exist
DEBUG: reading cache: .stack-work/dist/x86_64-osx/Cabal-1.22.5.0/setup-config.ghc-mod.resolved-components
VOMIT: Initializing GHC session with following options: "-fbuilding-cabal-package" "-O" "-outputdir" ".stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-odir" ".stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-hidir" ".stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-stubdir" ".stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-i" "-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp" "-iapp" "-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-isrc" "-i.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen" "-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/helloworld-exe/helloworld-exe-tmp" "-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen" "-I.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build" "-optP-include" "-optP.stack-work/dist/x86_64-osx/Cabal-1.22.5.0/build/autogen/cabal_macros.h" "-hide-all-packages" "-no-user-package-db" "-package-db" "/Users/yvenkatesh/.stack/snapshots/x86_64-osx/lts-5.8/7.10.3/pkgdb" "-package-db" "/Users/yvenkatesh/Documents/Haskell/helloworld/.stack-work/install/x86_64-osx/lts-5.8/7.10.3/pkgdb" "-package-id" "base-4.8.2.0-bfcc6de9ee2962ae54db40ece3022dc5" "-XHaskell2010" "-threaded" "-rtsopts" "-with-rtsopts=-N" "-O0"
DEBUG: initSession: Session not initialized, creating new one
DEBUG: loadTargets: Loading: app/Main.hs
DEBUG: loadTargets: Loading done
lierdakil commented 8 years ago

That's a completely different issue though... @callmeyesh, does disabling Enable GHC-Modi option in haskell-ghc-mod settings make any difference?

callmeyesh commented 8 years ago

@ilikebits No it doesn't help.

lierdakil commented 8 years ago

Okay. So from what I can gather, when run from Atom, ghc-mod tries to run cabal for some reason: ghc-mod: cabal: readCreateProcess: runInteractiveProcess: exec: does not exist (No such file or directory). It shouldn't do that on stack projects though (and it indeed does not in my tests).

Moreover, this happens in Atom, but not in command line. Only reason for that I can see is when run from Atom, ghc-mod can't find stack executable.

@callmeyesh, where is your stack executable, by the way? Is it on PATH?

callmeyesh commented 8 years ago

@lierdakil Yes

echo $PATH
/usr/local/bin:/usr/local/sbin:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home:/usr/local/Cellar/maven/3.2.5/libexec/bin:/usr/local/opt/rbenv/shims:/usr/local/opt/rbenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/go/bin:/Users/yvenkatesh/go/bin:/Users/yvenkatesh/.local/bin
ls /Users/yvenkatesh/.local/bin/
.               cabal           ghc-mod         hasktags        hlint           hscope          pointful        stylish-haskell
..              codex           ghc-modi        hdevtools       hoogle          pointfree       refactor
callmeyesh commented 8 years ago

In the settings, for Additional Path Directories I have added the following paths /usr/local/bin/ghc, /Users/yvenkatesh/.local/bin/cabal

And in the Ghc Mod Path /Users/yvenkatesh/.local/bin/ghc-mod

lierdakil commented 8 years ago

@callmeyesh, FYI, you misspell my handle... so it pings the wrong person.

I don't see stack in /Users/yvenkatesh/.local/bin/. Is it in /usr/local/bin/?

Also, do change 'Additional Path Directories' to /usr/local/bin, /Users/yvenkatesh/.local/bin -- it's directories, not executables... probably should change wording in places...

callmeyesh commented 8 years ago

@lierdakil Ah sorry about misspelling your handle. I installed stack using homebrew and its in /usr/local/bin.

I added /usr/local/bin to the Additional Path Directories and everything works fine now :+1:.

callmeyesh commented 8 years ago

Thanks for helping out @lierdakil & @DanielG. May be the README should be updated, so people who have installed stack using homebrew wont encounter this error.

lierdakil commented 8 years ago

Glad to hear it's working. I'll try to think of a better way of describing necessary configuration...

lierdakil commented 8 years ago

@ilikebits, could you check if this solution works for you? I think it might.

elldritch commented 8 years ago

Nope, mine is still breaking. Outputs:

cabal --version:

cabal-install version 1.22.8.0
using version 1.22.7.0 of the Cabal library 

ghc-mod --version: ghc-mod version 5.5.0.0 compiled by GHC 7.10.3

ghc-mod --verbose 7 check app/Main.hs:

DEBUG: reading cache: /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup-config.ghc-mod.cabal-components
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build","-isrc","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build","-optP-include","-optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp","-iapp","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp","-optP-include","-optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp","-itest","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp","-optP-include","-optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint: []
DEBUG: making sure autogen files exist
DEBUG: reading cache: .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup-config.ghc-mod.resolved-components
VOMIT: Initializing GHC session with following options: "-fbuilding-cabal-package" "-O" "-outputdir" ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-odir" ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-hidir" ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-stubdir" ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-i" "-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp" "-iapp" "-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-isrc" "-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen" "-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp" "-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen" "-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-optP-include" "-optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h" "-hide-all-packages" "-no-user-package-db" "-package-db" "/home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb" "-package-db" "/home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb" "-package-id" "aeson-0.9.0.1-62ec1692b2aab99727ba2164a55d993f" "-package-id" "lens-4.13-4fb6885cd5caa7082e913ef5ad067fac" "-package-id" "lens-aeson-1.0.0.5-0597cb9e40b29a21d7f4f88c6bf6f1d5" "-package-id" "text-1.2.2.0-daec687352505adca80a15e023cbae5c" "-package-id" "warp-3.2.2-2d5d2f594ac887399f099b34d0e229e7" "-package-id" "wreq-0.4.1.0-a03243b4c18c3a77ffbd67c3c6af5335" "-package-id" "base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d" "-package-id" "scotty-0.10.2-7a54656b519d424e7056839164fd244b" "-package-id" "wai-3.2.0-881c4cc8c44052f9133e13940117e71a" "-package-id" "wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3" "-package-id" "websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6" "-XHaskell2010" "-threaded" "-rtsopts" "-with-rtsopts=-N" "-O0"
DEBUG: initSession: Session not initialized, creating new one
ghc-mod: <command line>: cannot satisfy -package-id aeson-0.9.0.1-62ec1692b2aab99727ba2164a55d993f: 
    aeson-0.9.0.1-62ec1692b2aab99727ba2164a55d993f is unusable due to missing or recursive dependencies:
      attoparsec-0.13.0.1-7bb4ae138fae02d1d78899c6a27cfa8e bytestring-0.10.6.0-c60f4c543b22c7f7293a06ae48820437 containers-0.5.6.2-e59c9b78d840fa743d4169d4bea15592 hashable-1.2.4.0-1c5b5b3e4d9b3066cec16b077238de40 scientific-0.3.4.4-cc8f839ed8aee85a3e0740e9f558d2ea text-1.2.2.0-daec687352505adca80a15e023cbae5c time-1.5.0.1-edbd1a50e7922b396ada189ab8e8523b unordered-containers-0.2.5.1-6ad25c3b0727ccd065df1f0dd244dbf2
    (use -v for more information)

stack exec -- ghc-mod --verbose 7 check app/Main.hs:

DEBUG: reading cache: /home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup-config.ghc-mod.cabal-components
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build","-isrc","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build","-optP-include","-optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp","-iapp","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp","-optP-include","-optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint:
       ["-i","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp","-itest","-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen","-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator-test/operator-test-tmp","-optP-include","-optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h"]
DEBUG: resolveEntrypoint: []
DEBUG: making sure autogen files exist
DEBUG: reading cache: .stack-work/dist/x86_64-linux/Cabal-1.22.5.0/setup-config.ghc-mod.resolved-components
VOMIT: Initializing GHC session with following options: "-fbuilding-cabal-package" "-O" "-outputdir" ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-odir" ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-hidir" ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-stubdir" ".stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-i" "-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp" "-iapp" "-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-isrc" "-i.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen" "-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/operator/operator-tmp" "-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen" "-I.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build" "-optP-include" "-optP.stack-work/dist/x86_64-linux/Cabal-1.22.5.0/build/autogen/cabal_macros.h" "-hide-all-packages" "-no-user-package-db" "-package-db" "/home/leo/.stack/snapshots/x86_64-linux/lts-5.6/7.10.3/pkgdb" "-package-db" "/home/leo/Documents/Development/active/opthrift/bot-haskell/.stack-work/install/x86_64-linux/lts-5.6/7.10.3/pkgdb" "-package-id" "aeson-0.9.0.1-62ec1692b2aab99727ba2164a55d993f" "-package-id" "lens-4.13-4fb6885cd5caa7082e913ef5ad067fac" "-package-id" "lens-aeson-1.0.0.5-0597cb9e40b29a21d7f4f88c6bf6f1d5" "-package-id" "text-1.2.2.0-daec687352505adca80a15e023cbae5c" "-package-id" "warp-3.2.2-2d5d2f594ac887399f099b34d0e229e7" "-package-id" "wreq-0.4.1.0-a03243b4c18c3a77ffbd67c3c6af5335" "-package-id" "base-4.8.2.0-0d6d1084fbc041e1cded9228e80e264d" "-package-id" "scotty-0.10.2-7a54656b519d424e7056839164fd244b" "-package-id" "wai-3.2.0-881c4cc8c44052f9133e13940117e71a" "-package-id" "wai-websockets-3.0.0.8-a2f1ecb31baabad6236d51c83817b3e3" "-package-id" "websockets-0.9.6.1-50dae223286324293e0e0f1d64b6ada6" "-XHaskell2010" "-threaded" "-rtsopts" "-with-rtsopts=-N" "-O0"
DEBUG: initSession: Session not initialized, creating new one
DEBUG: loadTargets: Loading: app/Main.hs
DEBUG: loadTargets: Loading done

ghc-pkg list:

/opt/ghc/7.10.3/lib/ghc-7.10.3/package.conf.d
   Cabal-1.22.5.0
   array-0.5.1.0
   base-4.8.2.0
   bin-package-db-0.0.0.0
   binary-0.7.5.0
   bytestring-0.10.6.0
   containers-0.5.6.2
   deepseq-1.4.1.1
   directory-1.2.2.0
   filepath-1.4.0.0
   ghc-7.10.3
   ghc-prim-0.4.0.0
   haskeline-0.7.2.1
   hoopl-3.10.0.2
   hpc-0.6.0.2
   integer-gmp-1.0.0.0
   pretty-1.1.2.0
   process-1.2.3.0
   rts-1.0
   template-haskell-2.10.0.0
   terminfo-0.4.0.1
   time-1.5.0.1
   transformers-0.4.2.0
   unix-2.7.1.0
   xhtml-3000.2.1
/home/leo/.ghc/x86_64-linux-7.10.3/package.conf.d
   Cabal-1.22.7.0
   HTTP-4000.3.3
   StateVar-1.1.0.3
   adjunctions-4.3
   aeson-0.11.0.0
   annotated-wl-pprint-0.7.0
   ansi-terminal-0.6.2.3
   ansi-wl-pprint-0.6.7.3
   appar-0.1.4
   async-2.0.2
   attoparsec-0.13.0.1
   auto-update-0.1.3
   base-orphans-0.5.1
   base64-bytestring-1.0.0.1
   bifunctors-5.2.1
   blaze-builder-0.4.0.1
   blaze-html-0.8.1.1
   blaze-markup-0.7.0.3
   byteorder-1.0.4
   bytestring-builder-0.10.6.0.0
   case-insensitive-1.2.0.5
   charset-0.3.7.1
   cheapskate-0.1.0.4
   comonad-4.2.7.2
   contravariant-1.4
   cookie-0.4.1.6
   css-text-0.1.2.1
   data-default-0.5.3
   data-default-class-0.0.1
   data-default-instances-base-0.0.1
   data-default-instances-containers-0.0.1
   data-default-instances-dlist-0.0.1
   data-default-instances-old-locale-0.0.1
   digest-0.0.1.2
   distributive-0.5.0.2
   dlist-0.7.1.2
   easy-file-0.2.1
   exceptions-0.8.2.1
   fail-4.9.0.0
   fast-logger-2.4.1
   fingertree-0.1.1.0
   free-4.12.4
   fsnotify-0.2.1
   hashable-1.2.4.0
   hinotify-0.3.8.1
   http-types-0.9
   idris-0.10
   iproute-1.7.0
   kan-extensions-5.0.1
   lens-4.13.2
   lifted-base-0.2.3.6
   mmorph-1.0.6
   monad-control-1.0.0.5
   mtl-2.2.1
   network-2.6.2.1
   network-uri-2.6.0.3
   old-locale-1.0.0.7
   old-time-1.1.0.3
   optparse-applicative-0.12.1.0
   parallel-3.2.1.0
   parsec-3.1.9
   parsers-0.12.3
   prelude-extras-0.4.0.3
   primitive-0.6.1.0
   profunctors-5.2
   random-1.1
   reducers-3.12.1
   reflection-2.1.2
   resourcet-1.1.7.2
   safe-0.3.9
   scientific-0.3.4.4
   semigroupoids-5.0.1
   semigroups-0.18.1
   split-0.2.3
   stm-2.4.4.1
   streaming-commons-0.1.15.1
   stringsearch-0.3.6.6
   syb-0.6
   tagged-0.8.3
   tagsoup-0.13.8
   text-1.2.2.0
   transformers-base-0.4.4
   transformers-compat-0.5.1.4
   trifecta-1.5.2
   uniplate-1.6.12
   unix-compat-0.4.1.4
   unix-time-0.3.6
   unordered-containers-0.2.7.0
   utf8-string-1.0.1.1
   vault-0.3.0.6
   vector-0.11.0.0
   vector-binary-instances-0.2.1.1
   void-0.7.1
   wai-3.2.0
   wai-extra-3.0.14
   wai-logger-2.2.5
   word8-0.1.2
   xss-sanitize-0.3.5.6
   zip-archive-0.2.3.7
   zlib-0.6.1.1
callmeyesh commented 8 years ago

Not sure what happened but I am getting the following error again. This time stack exec atom also fails.

caps: {"version":[5,5,0,0],"legacyInteractive":true,"fileMap":true,"rootExec":false,"quoteArgs":true,"optparse":true,"typeConstraints":false,"browseParents":false,"interactiveCaseSplit":false} URI: /Users/yvenkatesh/Documents/Haskell/helloworld/app/Main.hs Args: -- message: ghc-mod: <command line>: cannot satisfy -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 (use -v for more information) log: -3.626s: getProcessOptions(/Users/yvenkatesh/Documents/Haskell/helloworld) -2.991s: PATH = /Users/yvenkatesh/.stack/snapshots/x86_64-osx/lts-5.8/7.10.3/bin:/usr/local/bin/ghc:/Users/yvenkatesh/.local/bin/cabal:/usr/local/bin:/usr/local/bin/stack:/Users/yvenkatesh/Documents/Haskell/helloworld/.stack-work/install/x86_64-osx/lts-5.8/7.10.3/bin:/usr/local/sbin:/Library/Java/JavaVirtualMachines/jdk1.8.0_20.jdk/Contents/Home:/usr/local/Cellar/maven/3.2.5/libexec/bin:/usr/local/opt/rbenv/shims:/usr/local/opt/rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/go/bin:/Users/yvenkatesh/go/bin:/Users/yvenkatesh/.local/bin :/Users/yvenkatesh/.local/bin -2.601s: Main created -2.601s: Main updating -2.594s: Main buffer is set -2.59s: Lib created -2.59s: Lib updating -2.588s: Lib moduleName mismatch: Main != Lib -2.578s: Lib moduleName mismatch: Main != Lib -2.578s: Prelude created -2.578s: Prelude updating -2.576s: Prelude moduleName mismatch: Main != Prelude -2.57s: Prelude moduleName mismatch: Main != Prelude -2.554s: {"version":[5,5,0,0],"legacyInteractive":true,"fileMap":true,"rootExec":false,"quoteArgs":true,"optparse":true,"typeConstraints":false,"browseParents":false,"interactiveCaseSplit":false} -2.553s: running /Users/yvenkatesh/.local/bin/ghc-mod lang,-- with options.cwd = /Users/yvenkatesh/Documents/Haskell/helloworld,options.env = [object Object],options.encoding = utf-8 -2.543s: running /Users/yvenkatesh/.local/bin/ghc-mod flag,-- with options.cwd = /Users/yvenkatesh/Documents/Haskell/helloworld,options.env = [object Object],options.encoding = utf-8 -2.541s: running /Users/yvenkatesh/.local/bin/ghc-mod browse,-d,--,Main with options.cwd = /Users/yvenkatesh/Documents/Haskell/helloworld,options.env = [object Object],options.encoding = utf-8 -2.538s: running /Users/yvenkatesh/.local/bin/ghc-mod browse,-d,--,Lib with options.cwd = /Users/yvenkatesh/Documents/Haskell/helloworld,options.env = [object Object],options.encoding = utf-8 -1.724s: /Users/yvenkatesh/.local/bin/ghc-mod ended with code 0 -1.72s: /Users/yvenkatesh/.local/bin/ghc-mod ended with code 0 -1.516s: ghc-mod said: EXCEPTION: browse: -1.516s: ghc-mod said: <command line>: cannot satisfy -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -1.516s: ghc-mod said: (use -v for more information) -1.512s: /Users/yvenkatesh/.local/bin/ghc-mod ended with code 0 -1.512s: running /Users/yvenkatesh/.local/bin/ghc-mod browse,-d,--,Prelude with options.cwd = /Users/yvenkatesh/Documents/Haskell/helloworld,options.env = [object Object],options.encoding = utf-8 -1.508s: Lib updated -1.488s: ghc-mod said: EXCEPTION: browse: -1.487s: ghc-mod said: Could not find module ‘Main’ -1.487s: ghc-mod said: Use -v to see a list of the files searched for. -1.482s: /Users/yvenkatesh/.local/bin/ghc-mod ended with code 0 -1.482s: Main updated -0.895s: running /Users/yvenkatesh/.local/bin/ghc-mod check,/Users/yvenkatesh/Documents/Haskell/helloworld/app/Main.hs,-- with options.cwd = /Users/yvenkatesh/Documents/Haskell/helloworld,options.env = [object Object],options.encoding = utf-8 -0.891s: running /Users/yvenkatesh/.local/bin/ghc-mod lint,/Users/yvenkatesh/Documents/Haskell/helloworld/app/Main.hs,-- with options.cwd = /Users/yvenkatesh/Documents/Haskell/helloworld,options.env = [object Object],options.encoding = utf-8 -0.888s: Main did-save triggered -0.888s: Main updating -0.887s: running /Users/yvenkatesh/.local/bin/ghc-mod browse,-d,--,Main with options.cwd = /Users/yvenkatesh/Documents/Haskell/helloworld,options.env = [object Object],options.encoding = utf-8 -0.628s: ghc-mod said: EXCEPTION: browse: -0.628s: ghc-mod said: <command line>: cannot satisfy -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -0.628s: ghc-mod said: (use -v for more information) -0.623s: /Users/yvenkatesh/.local/bin/ghc-mod ended with code 0 -0.623s: Prelude updated -0.005s: ghc-mod said: ghc-mod: <command line>: cannot satisfy -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 -0.005s: ghc-mod said: (use -v for more information) -0.001s: /Users/yvenkatesh/.local/bin/ghc-mod ended with code 1 0s: code 1: ghc-mod: <command line>: cannot satisfy -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 (use -v for more information)

Stack Trace

code 1: ghc-mod: <command line>: cannot satisfy -package-id base-4.8.2.0-cc43d8e06aa74e9c4c0132becc49ee25 (use -v for more information) at module.exports.Util.mkError (/Users/yvenkatesh/.atom/packages/haskell-ghc-mod/lib/util.coffee:154:15) at BufferedProcess.exit (/Users/yvenkatesh/.atom/packages/haskell-ghc-mod/lib/ghc-mod/ghc-modi-process-real.coffee:124:20) at triggerExitCallback (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:213:47) at /Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:220:18 at Socket.<anonymous> (/Applications/Atom.app/Contents/Resources/app.asar/src/buffered-process.js:98:18) at emitOne (events.js:82:20) at Socket.emit (events.js:169:7) at Pipe._onclose (net.js:469:12)

lierdakil commented 8 years ago

@callmeyesh, sorry for late reply. Health issues. Anyway, it seems like you try to run ghc-mod on a project using different GHC version than ghc-mod was built with. See https://github.com/atom-haskell/haskell-ghc-mod/wiki/Using-with-stack#maintain-a-separate-ghc-mod-installation-for-each-stack-resolver for more information on that.

lierdakil commented 8 years ago

Hopefully this should be resolved by now. If not, open new issue.