rikvdkleij / intellij-haskell

IntelliJ plugin for Haskell
https://rikvdkleij.github.io/intellij-haskell/
Apache License 2.0
1.31k stars 96 forks source link

Can't load Data.Map after stack.yaml add it. #663

Closed jiamo closed 2 years ago

jiamo commented 2 years ago

Use GHCI load module in ghci I got

/Users/jiamo/mtype/app/Named_func.hs:6:1: error:
    Could not load module ‘Data.Map’
    It is a member of the hidden package ‘containers-0.6.4.1’.
    You can run ‘:set -package containers’ to expose it.
    (Note: this unloads all the modules in the current scope.)
    Use -v (or `:set -v` in ghci) to see a list of the files searched for.
  |
6 | import Data.Map
  | ^^^^^^^^^^^^^^^
Failed, no modules loaded.

In console: stack repl

Using main module: 1. Package `mtype' component mtype:exe:mtype with main-is file: /Users/jiamo/mtype/app/Main.hs
Configuring GHCi with the following packages: mtype
GHCi, version 9.0.1: https://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Main             ( /Users/jiamo/mtype/app/Main.hs, interpreted )
Ok, one module loaded.
Loaded GHCi configuration from /private/var/folders/dn/h3lkn8751r56d14tdc687z1w0000gn/T/haskell-stack-ghci/a50491d1/ghci-script
ghci> import Data.Map

<no location info>: error:
    Could not load module ‘Data.Map’
    It is a member of the hidden package ‘containers-0.6.4.1’.
    You can run ‘:set -package containers’ to expose it.
    (Note: this unloads all the modules in the current scope.)
ghci>

However use stack exec ghci ok:

stack exec ghci
GHCi, version 9.0.1: https://www.haskell.org/ghc/  :? for help
ghci> import Data.Map
ghci>

with stack.yaml:

resolver: ghc-9.0.1
packages:
- .
extra-deps:
  - containers-0.6.5.1

system-ghc: true
install-ghc: false

The IDE also show the error:

Screen Shot 2021-08-03 at 22 34 10

rikvdkleij commented 2 years ago

You need to put normal dependencies like containers in cabal file, not in stack.yaml

jiamo commented 2 years ago

I will try later today. By the way 0.91 don't support idea-2020.2 ?

Screen Shot 2021-08-04 at 9 38 15 AM

rikvdkleij commented 2 years ago

Latest version is https://github.com/rikvdkleij/intellij-haskell/releases/tag/v1.0.0-beta87

See also plugin repo.

jiamo commented 2 years ago
Screen Shot 2021-08-04 at 5 43 20 PM

My mistake. may be we can put the latest beta version on right side page.