Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Some problem with stack repl #47

Closed
xgrommx opened this issue Oct 20, 2016 · 25 comments
Closed

Some problem with stack repl #47

xgrommx opened this issue Oct 20, 2016 · 25 comments

Comments

@xgrommx
Copy link

xgrommx commented Oct 20, 2016

Hello @rikvdkleij I got this log

03:16   [project-stack-repl] Build is starting

03:16   [project-stack-repl] Build command is `stack build --test --only-dependencies --haddock --fast`

03:16   [project-stack-repl] Build is finished

03:16   [project-stack-repl] Stack repl will be started with command: /usr/local/Cellar/haskell-stack/1.2.0_2/bin/stack repl --with-ghc intero --verbosity warn --fast --no-load --no-build --ghc-options -v1 --terminal --test

03:16   [project-stack-repl] The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
            * * * * * * * *
            The main module to load is ambiguous. Candidates are: 
            1. Package `haskell-app' component exe:haskell-app-exe with main-is file: /Users/gromm/work/haskell-app/app/Main.hs
            2. Package `haskell-app' component test:haskell-app-test with main-is file: /Users/gromm/work/haskell-app/test/Spec.hs
            You can specify which one to pick by: 
            * Specifying targets to stack ghci e.g. stack ghci haskell-app:exe:haskell-app-exe
            * Specifying what the main is e.g. stack ghci --main-is haskell-app:exe:haskell-app-exe
            * Choosing from the candidate above [1..2]
            * * * * * * * *


03:16   [project-stack-repl] Could not start Stack repl. Make sure you have set right path to Stack in settings.

03:16   [project-stack-repl] Error message while trying to start Stack repl: Stream closed

03:16   [project-stack-repl] Error while shutting down Stack repl for project haskell-app. Error message: Stream closed

I don't understand why. In my terminal stack repl is available

@rikvdkleij
Copy link
Owner

It looks like you hit this bug:
commercialhaskell/stack#2603

I have created workaround for this issue but apparently it does not work for you.

In the meantime it is fixed in master.
Can you try to upgrade Stack to master by:
stack upgrade --git

@xgrommx
Copy link
Author

xgrommx commented Oct 20, 2016

@rikvdkleij The same problem. My Stack Version 1.2.1, Git revision 7e31cd80e2394811ab62bf11295bfdfcf2d7c4d7 x86_64 hpack-0.14.1 and I use latest version of EAP of IDEA 2016

@rikvdkleij
Copy link
Owner

Can you show me complete Event log?

Did you reconfigure path to Stack? So you are sure latest version of Stack is used by IntelliJ.

Also check Intero is on your path.
stack exec -- which intero

@xgrommx
Copy link
Author

xgrommx commented Oct 20, 2016

@rikvdkleij What do u mean about? Did you reconfigure path to Stack? So you are sure latest version of Stack is used by IntelliJ. I have available stack in my terminal.

@xgrommx
Copy link
Author

xgrommx commented Oct 20, 2016

About iterno /Users/gromm/.stack/snapshots/x86_64-osx/lts-7.0/8.0.1/bin/intero

@xgrommx
Copy link
Author

xgrommx commented Oct 20, 2016

@rikvdkleij This is full log in my IDEA

10/20/16
15:55   [project-stack-repl] Build is starting

15:55   [project-stack-repl] Build command is `stack build --test --only-dependencies --haddock --fast`

15:55   [project-stack-repl] Build is finished

15:55   [project-stack-repl] Stack repl will be started with command: /usr/local/Cellar/haskell-stack/1.2.0_2/bin/stack repl --with-ghc intero --verbosity warn --fast --no-load --no-build --ghc-options -v1 --terminal --test

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
            * * * * * * * *
            The main module to load is ambiguous. Candidates are: 
            1. Package `haskell-app' component exe:haskell-app-exe with main-is file: /Users/gromm/work/haskell-app/app/Main.hs
            2. Package `haskell-app' component test:haskell-app-test with main-is file: /Users/gromm/work/haskell-app/test/Spec.hs
            You can specify which one to pick by: 
            * Specifying targets to stack ghci e.g. stack ghci haskell-app:exe:haskell-app-exe
            * Specifying what the main is e.g. stack ghci --main-is haskell-app:exe:haskell-app-exe
            * Choosing from the candidate above [1..2]
            * * * * * * * *


15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is started.

15:55   [global-stack-repl] Stack repl will be started with command: /usr/local/Cellar/haskell-stack/1.2.0_2/bin/stack repl --with-ghc intero --verbosity warn --fast --no-load --no-build --ghc-options -v1 --terminal --no-package-hiding

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [global-stack-repl] Intero 0.1.18 (GHC 7.10.3)
            Type :intro and press enter for an introduction of the standard commands.


15:55   [global-stack-repl] The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
            /Users/gromm/.stack/programs/x86_64-osx/ghc-8.0.1/lib/ghc-8.0.1/package.conf.d/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (not enough bytes)

15:55   [global-stack-repl] Could not start Stack repl. Make sure you have set right path to Stack in settings.

15:55   [global-stack-repl] Error message while trying to start Stack repl: Stream closed

15:55   [global-stack-repl] Error while shutting down Stack repl for project haskell-app. Error message: Stream closed

15:55   [global-stack-repl] Stack repl is stopped.

15:55   [project-stack-repl] No result from Stack repl within 5 seconds. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Error in communication with Stack repl: Stream closed. Check if your Haskell/Stack environment is working okay. Command was: :load

15:55   [project-stack-repl] Error while shutting down Stack repl for project haskell-app. Error message: Stream closed

15:55   [project-stack-repl] Stack repl is stopped.

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :complete repl "import " 

15:55   Could not preload library identifiers cache because could not obtain global project info

15:55   [global-stack-repl] Stack repl can not be stopped because it's already stopped or busy with stopping

15:55   [global-stack-repl] Stack repl will be started with command: /usr/local/Cellar/haskell-stack/1.2.0_2/bin/stack repl --with-ghc intero --verbosity warn --fast --no-load --no-build --ghc-options -v1 --terminal --no-package-hiding

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [global-stack-repl] Intero 0.1.18 (GHC 7.10.3)
            Type :intro and press enter for an introduction of the standard commands.


15:55   [global-stack-repl] The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
            /Users/gromm/.stack/programs/x86_64-osx/ghc-8.0.1/lib/ghc-8.0.1/package.conf.d/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (not enough bytes)

15:55   [global-stack-repl] Could not start Stack repl. Make sure you have set right path to Stack in settings.

15:55   [global-stack-repl] Error message while trying to start Stack repl: Stream closed

15:55   [global-stack-repl] Error while shutting down Stack repl for project haskell-app. Error message: Stream closed

15:55   [global-stack-repl] Stack repl is stopped.

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

15:55   [project-stack-repl] Stack repl is not yet available. Command was: :load /Users/gromm/work/haskell-app/src/Lib.hs

@rikvdkleij
Copy link
Owner

I mean before importing Haskell project you have to set path to folder where stack is installed.

If your project is already imported, take a look to module settings and Haskell Tool Stack setting.

@rikvdkleij
Copy link
Owner

[global-stack-repl] The following GHC options are incompatible with GHCi and have not been passed to it: -threaded /Users/gromm/.stack/programs/x86_64-osx/ghc-8.0.1/lib/ghc-8.0.1/package.conf.d/package.cache: GHC.PackageDb.readPackageDb: inappropriate type (not enough bytes)

This means Intero is build with other GHC version as project.

See .5 of Remarks in Readme.

@xgrommx
Copy link
Author

xgrommx commented Oct 20, 2016

@rikvdkleij I found problem! I have several versions of ghc. And for my case I need install stack install intero --resolver lts-7 because I use ghc-8 by default.

@xgrommx
Copy link
Author

xgrommx commented Oct 20, 2016

@rikvdkleij Oh man! I like this plugin! This is first plugin which works with stack!

@rikvdkleij
Copy link
Owner

@rikvdkleij I found problem! I have several versions of ghc. And for my case I need install stack install intero --resolver lts-7 because I use ghc-8 by default.

Great! Or better, in root folder of project stack build intero Because using install will install it globally. You do not want that if you have projects with different GHC versions.

I do not know how to make this robust.

It's also issue for haskell-docs.

@rikvdkleij
Copy link
Owner

@rikvdkleij Oh man! I like this plugin! This is first plugin which works with stack!

Thanks!

@rikvdkleij
Copy link
Owner

Maybe solution is when importing/starting project to build intero and haskell-docs so they are always compatible with GHC-version of your project.

@xgrommx
Copy link
Author

xgrommx commented Oct 20, 2016

@rikvdkleij Do u have some plan to port some features like here http://haskforce.com/ ? For example Automatically add type signatures

@rikvdkleij
Copy link
Owner

It's already there, an intention action, ctrl + enter

@xgrommx
Copy link
Author

xgrommx commented Oct 20, 2016

@rikvdkleij ok, but what is on Mac?

@xgrommx
Copy link
Author

xgrommx commented Oct 20, 2016

ctrl + enter is just smart split.

@rikvdkleij
Copy link
Owner

Sorry, it's alt + enter

@unthingable
Copy link

I've been unable to get it to add a type signature. Intero REPL is started successfully, hlint is configured, this is happening with both 1.0 beta and beta2. Nothing is happening upon alt-enter, and no Haskell intentions are listed in IDEA settings (is that normal?). Meanwhile, when I hit alt+enter, I do see the type signature spit out by the REPL in the event log!

IntelliJ IDEA 2016.2.5
JRE: 1.8.0_112-release-287-b2 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS Sierra

@rikvdkleij
Copy link
Owner

The type signature is extracted from compiler warning.

Can you give me the type signature that is spit out by Repl?

@unthingable
Copy link

Sure. Hitting alt-enter on a line foo = 1:

13:28   [project-stack-repl] command: :type-at /Users/[...]/src/Main.hs 58 1 58 4 foo

13:28   [project-stack-repl] stdOut: foo :: Integer
            ^IntellijHaskell^

13:28   [project-stack-repl] errOut: 

@unthingable
Copy link

"The type signature is extracted from compiler warning." — after rereading that a forehead smack is appropriate. GHC warnings have been turned off. Added -Wall to ghc-options in .cabal and now it works.

@JonasTaulien
Copy link

On my PC (Debian Jessie) I had to 'sudo apt-get install libtinfo-dev' and re-import the project. After that the repl was running successfully :)

@overdeliver
Copy link

I ran into this, too. Had to 'sudo apt-get install ncurses-dev' then did 'stack build terminfo' and 'stack build intero', in the root of the project, then opened up IntelliJ to find everything working. This was after I did a: 'stack upgrade --git' as suggested earlier.

@rikvdkleij
Copy link
Owner

@overdeliver So plugin works?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants