haskell-mode icon indicating copy to clipboard operation
haskell-mode copied to clipboard

Interactive mode cannot work for stack ghci

Open zhouqiji opened this issue 9 years ago • 10 comments
trafficstars

HI, appreciate you guys notice this issue, My working environment is: WIndows 10 64 bit, emacs 24.5.1

My problem is that when I start interactive mode in eamcs, it would say:

 "The Haskell process `haskell` has died."

And the process log shows:

("Starting inferior stack GHCi process using stack" "haskell" nil "stack" "ghci" "--ghc-options=-ferror-spans")

-> Prelude.putStrLn ""
:set -v1
:set +c
-> :set prompt "\4"
-> :set prompt2 "λ| "
<- Run from outside a project, using implicit global project config
<- Error parsing targets: The specified targets matched no packages.
   Perhaps you need to run 'stack init'?
   Warning: build failed, but optimistically launching GHCi anyway
<- Configuring GHCi with the following packages: 
   GHCi, version 7.10.3: http://www.haskell.org/ghc/  :? for help
<- Ok, modules loaded: none.
   Prelude> 
   Prelude> Prelude> unknown option: 'c'
   Prelude> Leaving GHCi.
Event: "finished"
Process reset.

May I ask how to solve it? Thanks!

zhouqiji avatar Jun 23 '16 14:06 zhouqiji

Looks like something wrong with working directory on Windows.

geraldus avatar Jun 23 '16 18:06 geraldus

Hmm… I overviewed haskell-interactive.el and did not found a piece of code where project's root folder lookup occur.

geraldus avatar Jun 23 '16 19:06 geraldus

Thanks for your reply, It works well on my ubuntu machine. But still cannot work for windows...... Is it possible the stack problem?

zhouqiji avatar Jun 26 '16 10:06 zhouqiji

@zhouqiji I can't be certain, sorry for delay @gracjan can tell how interactive mode determines the project directory (I see no clue in sources)?

geraldus avatar Jun 30 '16 07:06 geraldus

It tries to find *.cabal by going up the directories.

gracjan avatar Jun 30 '16 17:06 gracjan

Do you know how it gets current directory (from where to start)?

geraldus avatar Jun 30 '16 19:06 geraldus

@geraldus: I do not think that current working directory is managed somehow differently under unix versus windows.

I'm working on a testing environment for Windows so if somebody wants to write a test case for this particular issue and make sure it works on Unix then we will be able to also check same scenario on Windows.

gracjan avatar Jul 12 '16 13:07 gracjan

@zhouqiji I tried this out on a Windows 7 box and I got it fixed by:

  1. Following step 3 in https://www.haskell.org/platform/windows.html#windows
  2. Running stack setup.

Does that work for you?

fice-t avatar Aug 18 '16 23:08 fice-t

@fice-t Appreciate your help, I will try it. :)

zhouqiji avatar Aug 19 '16 15:08 zhouqiji

I have the same problem,but I don't know how to solve. The haskell process log is

`("Starting inferior stack GHCi process using stack" "haskell" nil "stack" "ghci" "--ghc-options=-ferror-spans") -> Prelude.putStrLn "" :set -v1 :set +c -> :set prompt "\4" -> :set prompt2 "λ| " <- Note: No local targets specified, so a plain ghci will be started with no package hiding or package options.

     If you want to use package hiding and options, then you can try one of the following:
     
     * If you want to start a different project configuration
       than C:\sr\global-project\stack.yaml, then you can use stack init to create a new stack.yaml
       for the packages in the current directory. 
       
     * If you want to use the project configuration
       at C:\sr\global-project\stack.yaml, then you can add to its 'packages' field.

<- Configuring GHCi with the following packages:

<- GHCi, version 8.6.3: http://www.haskell.org/ghc/ :? for help

<- Loaded GHCi configuration from C:\Users\bugczw\AppData\Local\Temp\haskell-stack-ghci\2a3bbd58\ghci-script Prelude> Prelude> Prelude> Prelude> Leaving GHCi.`

bugczw avatar Mar 05 '19 07:03 bugczw