Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oscarvarto/204e9ce6244435bb725066b529644698 to your computer and use it in GitHub Desktop.
Save oscarvarto/204e9ce6244435bb725066b529644698 to your computer and use it in GitHub Desktop.
Output/log error message after opening haskell-language-server repo with VSCode
Starting GHCi with: "stack --no-terminal --color never repl --no-load ghcide:lib ghcide:exe:ghcide ghcide:exe:ghcide-bench ghcide:exe:ghcide-test-preprocessor ghcide:test:ghcide-tests ghcide:bench:benchHist haskell-language-server:lib haskell-language-server:exe:haskell-language-server haskell-language-server:exe:haskell-language-server-wrapper haskell-language-server:test:func-test haskell-language-server:test:wrapper-test"
(Under cwd /home/oscarvarto/gitRepos/haskell-language-server)
-> :set prompt ""
|> :set prompt-cont ""
ghci |
ghci | * * * * * * * *
ghci | Warning: There are cabal settings for this project which may prevent GHCi from loading your code properly.
ghci | In some cases it can also load some projects which would otherwise fail to build.
ghci |
ghci | -XOverloadedStrings will be used, but it can cause type ambiguity in code not usually compiled with it.
ghci | It is specified for:
ghci | ghcide:lib ghcide:exe:ghcide ghcide:exe:ghcide-bench ghcide:test:ghcide-tests ghcide:bench:benchHist
ghci | But not for:
ghci | ghcide:exe:ghcide-test-preprocessor haskell-language-server:lib haskell-language-server:exe:haskell-language-server haskell-language-server:exe:haskell-language-server-wrapper haskell-language-server:test:func-test haskell-language-server:test:wrapper-test
ghci |
ghci | To resolve, remove the flag(s) from the cabal file(s) and instead put them at the top of the haskell files.
ghci |
ghci | It isn't yet possible to load multiple packages into GHCi in all cases - see
ghci | https://ghc.haskell.org/trac/ghc/ticket/10827
ghci | * * * * * * * *
ghci |
ghci | The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
ghci | Configuring GHCi with the following packages: ghcide, haskell-language-server
ghci |
ghci | Warning: Didn't find expected autogen file:
ghci | /home/oscarvarto/gitRepos/haskell-language-server/ghcide/.stack-work/dist/x86_64-linux-tinfo6/Cabal-2.4.0.1/build/benchHist/autogen/cabal_macros.h
ghci | GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help
ghci | <command line>: cannot satisfy -package Chart-1.9.3
ghci | (use -v for more information)
Error checking /home/oscarvarto/gitRepos/haskell-language-server/Setup.hs: stream closed
Error checking /home/oscarvarto/gitRepos/haskell-language-server/src/Ide/Types.hs: stream closed
Error providing range type: stream closed
@lukel97
Copy link

lukel97 commented Jul 28, 2020

What project are you running haskell-language-server on? Is it haskell-language-server itself? Can you check that running stack repl works ok on it

@oscarvarto
Copy link
Author

@bubba. Thanks for helping! I am running haskell-language-server on itself, yes. stack repl does not work. I get the following:

* * * * * * * *
The main module to load is ambiguous. Candidates are:
1. Package `ghcide' component ghcide:exe:ghcide with main-is file: /home/oscarvarto/gitRepos/haskell-language-server/ghcide/exe/Main.hs
2. Package `ghcide' component ghcide:exe:ghcide-bench with main-is file: /home/oscarvarto/gitRepos/haskell-language-server/ghcide/bench/exe/Main.hs
3. Package `ghcide' component ghcide:exe:ghcide-test-preprocessor with main-is file: /home/oscarvarto/gitRepos/haskell-language-server/ghcide/test/preprocessor/Main.hs
4. Package `haskell-language-server' component haskell-language-server:exe:haskell-language-server with main-is file: /home/oscarvarto/gitRepos/haskell-language-server/exe/Main.hs
5. Package `haskell-language-server' component haskell-language-server:exe:haskell-language-server-wrapper with main-is file: /home/oscarvarto/gitRepos/haskell-language-server/exe/Wrapper.hs
You can specify which one to pick by:
 * Specifying targets to stack ghci e.g. stack ghci ghcide:exe:ghcide
 * Specifying what the main is e.g. stack ghci --main-is ghcide:exe:ghcide
 * Choosing from the candidate above [1..5]
* * * * * * * *

Specify main module to use (press enter to load none): 1
Loading main module from candidate 1, --main-is /home/oscarvarto/gitRepos/haskell-language-server/ghcide/exe/Main.hs

ghcide                 > configure (lib + exe)
ghcide                 > Configuring ghcide-0.2.0...
ghcide                 > initial-build-steps (lib + exe)
haskell-language-server> configure (lib + exe)
haskell-language-server> Configuring haskell-language-server-0.2.2.0...
haskell-language-server> initial-build-steps (lib + exe)
Completed 2 action(s).

* * * * * * * *
Warning: There are cabal settings for this project which may prevent GHCi from loading your code properly.
In some cases it can also load some projects which would otherwise fail to build.

-XOverloadedStrings will be used, but it can cause type ambiguity in code not usually compiled with it.
It is specified for:
    ghcide:lib ghcide:exe:ghcide ghcide:exe:ghcide-bench
But not for:
    ghcide:exe:ghcide-test-preprocessor haskell-language-server:lib haskell-language-server:exe:haskell-language-server haskell-language-server:exe:haskell-language-server-wrapper

To resolve, remove the flag(s) from the cabal file(s) and instead put them at the top of the haskell files.

It isn't yet possible to load multiple packages into GHCi in all cases - see
https://ghc.haskell.org/trac/ghc/ticket/10827
* * * * * * * *

The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
Configuring GHCi with the following packages: ghcide, haskell-language-server

* * * * * * * *

Error: Multiple files use the same module name:
       * Arguments found at the following paths
         * /home/oscarvarto/gitRepos/haskell-language-server/exe/Arguments.hs (haskell-language-server:exe:haskell-language-server,
           haskell-language-server:exe:haskell-language-server-wrapper)
         * /home/oscarvarto/gitRepos/haskell-language-server/ghcide/exe/Arguments.hs (ghcide:exe:ghcide)
* * * * * * * *

Not attempting to start ghci due to these duplicate modules.
Use --no-load to try to start it anyway, without loading any modules (but these are still likely to cause errors)

I get a similar error if I don't load any module.

Anyway, haskell-language-server works for simpler projects. Thanks for the interest!

@lukel97
Copy link

lukel97 commented Aug 6, 2020

Your best bet is to add a hie.yaml file at the root of your project to manually specify what component to load, there's some examples here: https://github.com/mpickering/hie-bios#stack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment