phoityne / ghci-dap

ghci having DAP interface.
https://hackage.haskell.org/package/ghci-dap
Other
19 stars 3 forks source link

Cannot start on macOS #3

Open varosi opened 4 years ago

varosi commented 4 years ago

Configuration: LTS-15.5 GHC 8.8.3 macOS 10.15.4 Catalina installed via: stack install haskell-dap ghci-dap haskell-debug-adapter as mentioned in Haskell GHCi Debug Adapter plug-in of VS Code.

I'm trying to run: stack ghci --with-ghc=ghci-dap --no-build --main-is main

on a sample project generated with: stack new dbg2

And it gave me:

/Users/vasko/Projects/haskell/test/dbg2/dbg2.cabal was modified manually. Ignoring /Users/vasko/Projects/haskell/test/dbg2/package.yaml in favor of the cabal file. If you want to use the package.yaml file instead of the cabal file, then please delete the cabal file. Configuring GHCi with the following packages: dbg2 [DAP][INFO] start ghci-dap-0.0.14.0. GHCi, version 8.6.5: http://www.haskell.org/ghc/ :? for help

:1:6: error: Not in scope: ‘System.IO.hSetBuffering’ No module named ‘System.IO’ is imported. :1:30: error: Not in scope: ‘System.IO.stdin’ No module named ‘System.IO’ is imported. :1:46: error: Not in scope: data constructor ‘System.IO.NoBuffering’ No module named ‘System.IO’ is imported. :1:70: error: Not in scope: ‘System.IO.hSetBuffering’ No module named ‘System.IO’ is imported. :1:94: error: Not in scope: ‘System.IO.stdout’ No module named ‘System.IO’ is imported. :1:111: error: Not in scope: data constructor ‘System.IO.NoBuffering’ No module named ‘System.IO’ is imported. :1:135: error: Not in scope: ‘System.IO.hSetBuffering’ No module named ‘System.IO’ is imported. :1:159: error: Not in scope: ‘System.IO.stderr’ No module named ‘System.IO’ is imported. :1:176: error: Not in scope: data constructor ‘System.IO.NoBuffering’ No module named ‘System.IO’ is imported.

I have tried also without --no-build option: stack ghci --with-ghc=ghci-dap --main-is main and it was the same.

What can I do more?

varosi commented 4 years ago

If I run regular GHCi at the same place, like: stack ghci --main-is main and inside I do: System.IO.putStrLn "test" It doesn't give errors.

varosi commented 4 years ago

hm, It's strange that ghci-dap is running

[DAP][INFO] start ghci-dap-0.0.14.0. GHCi, version 8.6.5

instead of GHCi 8.8.3

varosi commented 4 years ago

It's my fault. I have builded it in another folder, where LTS was older.

But do you think that it could be good if there is a runtime check if versions mismatch and showing that to the user without proceeding with GHCi?

varosi commented 4 years ago

hm, there is another problem after matching the versions. When running debug session in VS Code, I got:

CMD: stack ghci --with-ghc=ghci-dap --no-build --main-is main Now, waiting for an initial prompt("Prelude>") from ghci.

And waiting infinitely. Then I tried to run the same command from the console:

stack ghci --with-ghc=ghci-dap --no-build --main-is main /Users/vasko/Projects/haskell/test/dbg2/dbg2.cabal was modified manually. Ignoring /Users/vasko/Projects/haskell/test/dbg2/package.yaml in favor of the cabal file. If you want to use the package.yaml file instead of the cabal file, then please delete the cabal file. Configuring GHCi with the following packages: dbg2 [DAP][INFO] start ghci-dap-0.0.14.0. GHCi, version 8.8.3: https://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Lib ( /Users/vasko/Projects/haskell/test/dbg2/src/Lib.hs, interpreted ) Ok, one module loaded. Loaded GHCi configuration from /private/var/folders/9f/s1y16f_95tq8ldsqzc2kfmm80000gn/T/haskell-stack-ghci/c6e38927/ghci-script *Lib Lib>

So it actually doesn't end with "Prelude>".

varosi commented 4 years ago

Ah, found the solution. In launch.json file the field ghciInitialPrompt should be: "ghciInitialPrompt": "> "

What you think if this is the default value of it ('>' plus a space), so it doesn't depend on what library or folder is setup?

phoityne commented 4 years ago

But do you think that it could be good if there is a runtime check if versions mismatch and showing that to the user without proceeding with GHCi?

What you think if this is the default value of it ('>' plus a space), so it doesn't depend on what library or folder is setup?

Thanks for your requests. 1st one, if ghci-dap can get the runtime ghc version(user development environment) somehow, I will add a version check.

2nd, I also think that only '> ' would be ok, as a default value.

Regards.