Haskell-ide-engine: Can not load module in Setup.hs

Created on 18 Feb 2019  ·  17Comments  ·  Source: haskell/haskell-ide-engine

Hi, I', not sure this is a problem related to hie, bare with me asking here.

Environment:

  • Mac OSX Mojave
  • Only install stack (v1.9.3) via home brew instead of Haskell platform.
  • HIE source build for 8.6.3 (lts-13.8)
  • vscode plugin for editor frontend.

Everything works fine: code completion, linting, formatting, etc; but there's always an error log on vscode as following for Setup.hs:

Could not load module ‘Prelude’
It is a member of the hidden package ‘base-4.12.0.0’.
You can run ‘:set -package base’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v to see a list of the files searched for.

Could not load module ‘Distribution.Simple’
It is a member of the hidden package ‘Cabal-2.4.1.0’.
You can run ‘:set -package Cabal’ to expose it.
(Note: this unloads all the modules in the current scope.)
It is a member of the hidden package ‘Cabal-2.4.0.1’.
You can run ‘:set -package Cabal’ to expose it.
(Note: this unloads all the modules in the current scope.)
Use -v to see a list of the files searched for.

This is quite bothering me, am I missing anything? Thanks!

macOS linux vscode

Most helpful comment

What do you mean by "none-cradle"? Where do you specify that?

cradle:
  multi:
    - path: ./
      config:
        cradle:
          cabal:
            component: "lib:project"
    - path: ./Setup.hs # path to associate a cradle with
#           ^--------- Path to load
      config:
        cradle:
          none: # The cradle associated with the path "./Setup.hs" is a "none"-cradle
#         ^------ None Cradle

All 17 comments

I am having the exact same issue, don't know what I missed here.

@alanz could these be .ghc.environment files?

Same issue

OS: Debian 9.8 stretch
HIE source build for 8.6.3 (lts-13.8)

Can someone post the output of the hie.log (first part, giving environment, versions, etc) so we can confirm exactly what is running?

Here's my log dumped from vscode:

2019-03-01 16:10:26.684489 [ThreadId 4] - run entered for hie-wrapper(hie-wrapper) Version 0.6.0.0, Git revision 5b4f45c7a9f51378a1501e58455836f3c6d69f5b (2419 commits) x86_64 ghc-8.6.3
2019-03-01 16:10:26.68741 [ThreadId 4] - Current directory:/Users/tz70s/WorkSpace/haskell/sandbox
2019-03-01 16:10:26.894954 [ThreadId 4] - Cradle directory:/Users/tz70s/WorkSpace/haskell/sandbox
2019-03-01 16:10:26.895633 [ThreadId 4] - Using stack GHC version
2019-03-01 16:10:27.103467 [ThreadId 4] - Project GHC version:8.6.3
2019-03-01 16:10:27.104133 [ThreadId 4] - hie exe candidates :["hie-8.6.3","hie-8.6","hie"]
2019-03-01 16:10:27.107102 [ThreadId 4] - found hie exe at:/Users/tz70s/.local/bin/hie-8.6.3
2019-03-01 16:10:27.107677 [ThreadId 4] - args:[]
2019-03-01 16:10:27.107961 [ThreadId 4] - launching ....

2019-03-01 16:10:27.174357 [ThreadId 4] - Using stack GHC version
2019-03-01 16:10:27.386277 [ThreadId 4] - Run entered for HIE(hie-8.6.3) Version 0.6.0.0, Git revision 5b4f45c7a9f51378a1501e58455836f3c6d69f5b (2419 commits) x86_64 ghc-8.6.3
2019-03-01 16:10:27.389114 [ThreadId 4] - Current directory:/Users/tz70s/WorkSpace/haskell/sandbox
2019-03-01 16:10:27.664722 [ThreadId 10] - Using Using hie version: Version 0.6.0.0, Git revision 5b4f45c7a9f51378a1501e58455836f3c6d69f5b (2419 commits) x86_64 ghc-8.6.3
stack GHC version
Using hoogle db at: /Users/tz70s/.hoogle/default-haskell-5.0.17.hoo

I think this is not an issue specific to hie (and also vscode-hie), I can reproduce this after switching to Intero (and spacemacs). Maybe it's caused by build tool settings (stack, cabal)?

My log

2019-03-01 11:20:49.526002938 [ThreadId 4] - run entered for hie-wrapper(hie-wrapper) Version 0.6.0.0, Git revision ba44c5841d687896c5f8101742ae2051fe1c6fbb (2434 commits) x86_64 ghc-8.6.3
2019-03-01 11:20:49.536708287 [ThreadId 4] - Current directory:/home/akhoroshev/Documents/fl_ifmo_2019_spr
2019-03-01 11:20:49.552053516 [ThreadId 4] - Cradle directory:/home/akhoroshev/Documents/fl_ifmo_2019_spr
2019-03-01 11:20:49.579337315 [ThreadId 4] - Using plain GHC version
2019-03-01 11:20:49.70233963 [ThreadId 4] - Project GHC version:8.6.3
2019-03-01 11:20:49.702639261 [ThreadId 4] - hie exe candidates :["hie-8.6.3","hie-8.6","hie"]
2019-03-01 11:20:49.703190917 [ThreadId 4] - found hie exe at:/home/akhoroshev/.local/bin/hie-8.6.3
2019-03-01 11:20:49.703501264 [ThreadId 4] - args:["--lsp"]
2019-03-01 11:20:49.703686134 [ThreadId 4] - launching ....



2019-03-01 11:20:49.72275248 [ThreadId 4] - Using plain GHC version
2019-03-01 11:20:49.911902634 [ThreadId 4] - Run entered for HIE(hie-8.6.3) Version 0.6.0.0, Git revision ba44c5841d687896c5f8101742ae2051fe1c6fbb (2434 commits) x86_64 ghc-8.6.3
2019-03-01 11:20:49.913238673 [ThreadId 4] - Current directory:/home/akhoroshev/Documents/fl_ifmo_2019_spr
2019-03-01 11:20:50.011114276 [ThreadId 10] - Using plain GHC version
Using hie version: Version 0.6.0.0, Git revision ba44c5841d687896c5f8101742ae2051fe1c6fbb (2434 commits) x86_64 ghc-8.6.3
Using hoogle db at: /home/akhoroshev/.hoogle/default-haskell-5.0.17.hoo

tested with stack/cabal on an empty proejct

I think Setup.hs file is an entry point for the cabal builder itself, and it is unrelated to the rest of the build. So ghc-mod might get a little confused. Can we prevent sending diagnostics for Setup.hs, as getting them while opening this file is a bit annoying?

It's definitely not only macOS issue. The same happens on Linux envs. Fresh cabal init project and it happens for me on any multiple linux environments.

Same here 👍
Can we do something about it?

I'm running into this too on a fresh stack init project -- not vscode specific though: I see it when I exec ghcide from the command line as well

Me too I'm having this on a newly created stack project, is there a way to say "ignore this file"? perhaps that would be enough to fix that for now.

Soon, in #1126, ignoring certain files will be possible

Not sure if it's relevant but I get this too with ghcide https://github.com/digital-asset/ghcide/issues/135#issuecomment-568905012

@fendor i see that PR was merged but i haven't been able to find anything about how to ignore certain files?

@willisplummer You can specify exactly which files to load with a hie.yaml file.
Examples are at: https://github.com/haskell/haskell-ide-engine#project-configuration

cradle:
  multi:
    - path: ./
      config:
        cradle:
          cabal:
            component: "lib:project"
    - path: ./Setup.hs
      config:
        cradle:
          none:

You can use a none-cradle to signal that this path should never be loaded.

@willisplummer You can specify exactly which files to load with a hie.yaml file.
Examples are at: https://github.com/haskell/haskell-ide-engine#project-configuration

cradle:
  multi:
    - path: ./
      config:
        cradle:
          cabal:
            component: "lib:project"
    - path: ./Setup.hs
      config:
        cradle:
          none:

You can use a none-cradle to signal that this path should never be loaded.

What do you mean by "none-cradle"? Where do you specify that?

What do you mean by "none-cradle"? Where do you specify that?

cradle:
  multi:
    - path: ./
      config:
        cradle:
          cabal:
            component: "lib:project"
    - path: ./Setup.hs # path to associate a cradle with
#           ^--------- Path to load
      config:
        cradle:
          none: # The cradle associated with the path "./Setup.hs" is a "none"-cradle
#         ^------ None Cradle
Was this page helpful?
0 / 5 - 0 ratings

Related issues

alanz picture alanz  ·  3Comments

mouse07410 picture mouse07410  ·  4Comments

ghost picture ghost  ·  4Comments

alanz picture alanz  ·  3Comments

alanz picture alanz  ·  3Comments