Installation of newer versions of stack with server on Visual Studio Code

Visual Studio Code - Windows 11

I wasn’t able to run the debug with the newer versions installed of stack. The installation remains incredibly complex on my point of view. I don’t know also the command lines normally used, the Linux enviroment and also all the Haskell enviroment. I’ve found also the informations on plug in unuseful, there isn’t a unique sure way or ways of steps to follow, considering the needing of all plugin installed on Visual Studio Code, enviroment variables to set, and commands to execute on PowerShell, and configuration files on the project, and the server links needed. All these things together make the path impossible to follow and the errors simply indecipherable.

It is needed a simple guide of steps to follow and things to do with one or more ways if the auto configuration isn’t possible.

For the project i’ve used the auto created laungh.json for haskell debug and the standard project created directly from stack with “stack new sample” on PowerShell to create automatically the first hs files and the files yaml needed.

The installations of GHCup all done.

There are also problems with npm and node.js launching the debugger extension for Visual Studio Code, with node already installed.

The Copilot AI isn’t able to fix all the problems encountered. It tries to make better configurations or to give tips asking informations without any result.

This is the error reported for debug stack:


start debugging failed. user error (ExecResult not found.)

HasCallStack backtrace:

collectBacktraces, called at libraries\ghc-internal\src\GHC\Internal\Exception.hs:169:13 in ghc-internal:GHC.Internal.Exception

toExceptionWithBacktrace, called at libraries\ghc-internal\src\GHC\Internal\IO.hs:260:11 in ghc-internal:GHC.Internal.IO

throwIO, called at app\GHCi\DAP\Utility.hs:191:23 in ghci-dap-0.0.26.0-IWRnVWFJmsXKimZZG5XAVQ-ghci-dap:GHCi.DAP.Utility

: Left “user error (ExecResult not found.)\nHasCallStack backtrace:\n collectBacktraces, called at libraries\\ghc-internal\\src\\GHC\\Internal\\Exception.hs:169:13 in ghc-internal:GHC.Internal.Exception\n toExceptionWithBacktrace, called at libraries\\ghc-internal\\src\\GHC\\Internal\\IO.hs:260:11 in ghc-internal:GHC.Internal.IO\n throwIO, called at app\\GHCi\\DAP\\Utility.hs:191:23 in ghci-dap-0.0.26.0-IWRnVWFJmsXKimZZG5XAVQ-ghci-dap:GHCi.DAP.Utility\n\n”

1 Like

Is this about using the experimental haskell-debugger?

Or do you just want to build and compile haskell programs in VSCode?

(Traditionally Haskell hasn’t had much debugger support, so I wouldn’t be very surprised if that doesn’t work out of the box.)

1 Like

This happens using the haskell(stack) dubugger as recommended from the phoityne plugin.

1 Like

Ditch that debugger extension, for now at least, and stick to the core tools. As mentioned, there’s a new better Haskell debugger integration on the horizon, so I’d wait for that.

Does opening VSCode’s integrated terminal and running stack build and stack ghci work? And are you getting correct feedback in the editor from the language server (errors, warnings, information on hover)?

1 Like

All the configurations installed work properly, remaining in the PowerShell enviroment, there is some problem also in this case, but having the yaml auto defined with the stack commands on PowerShell, the installations go correctly. The major lack seems to be the comunication of the plugins, the installations done on PowerShell, the configurations files(yaml, node), and the Visual Studio Code enviroment that can install automatically other files required with Haskell topic. I ran ghci with few problems on PowerShell. On top of that there could be some problem with the server, as i seen in the plugins informations, if all that will run, and this can add major complexity, if all doesn’t communicate properly. But these is my opinion. Simply i see that is difficult to understand the problem.

Below some configurations:

stack --version Version 3.7.1, Git revision 331f4880f1a33f1d39e14317dc9ecc6d3d6d617d x86_64 hpack-0.38.1

haskell-debug-adapter --version haskell-debug-adapter-0.0.42.0

I’ve seen this for Horizon:

1 Like

As @george.fst mentioned, the new and improved haskell-debugger will work only starting with GHC 9.14 (whose final release is not yet available).

The new debugger should handle projects with cabal and stack seamlessly, since it uses hie-bios, the same technology powering the environment set-up for HLS.

I suggest you resort to ghci / stack repl for now instead. If you are really keen to use a debugger, you can try the GHC 9.14 release candidate with the new debugger by following the instructions in haskell-debugger website

3 Likes

A general appeal by me: Stack’s online documentation aims to help users of Visual Studio Code and users on Windows. If the following documentation is found to be inaccurate, incomplete, or unclear, please do post at Stack’s GitHub repository or here:

1 Like

I’ve installed GHCUP, in the UI i’ve defined GHC 9.14 latest. But Cabal install doesn’t permit the installation of haskell-debugger. I watched the part of the video with the three points needed, but i cannot see the hdb executable. I’ve installed the plugin you recommended on Visual Studio Code. The next step will be configure the jason message for DAP accordingly. Is it possible to install the correct GHC with the correct Haskell-Debugger version?

I also notice that GHCUP can have some problems if all installations are defined like HLS on Windows 11. But partial installation with standard settings functions, about 11 GB.

Error message:


command –> cabal install haskell-debugger

Resolving dependencies…
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] trying: haskell-debugger-0.10.1.0 (user goal)
[__1] trying: unordered-containers-0.2.20.1 (dependency of haskell-debugger)
[__2] next goal: template-haskell (dependency of unordered-containers)
[__2] rejecting: template-haskell-2.24.0.0/installed-02a7 (conflict: unordered-containers => template-haskell<2.24)
[__2] rejecting: template-haskell; 2.23.0.0, 2.22.0.0, 2.21.0.0, 2.20.0.0, 2.19.0.0, 2.18.0.0, 2.17.0.0, 2.16.0.0, 2.15.0.0, 2.14.0.0, 2.13.0.0, 2.12.0.0, 2.11.1.0, 2.11.0.0, 2.10.0.0, 2.9.0.0, 2.8.0.0, 2.7.0.0, 2.6.0.0, 2.5.0.0, 2.4.0.1, 2.4.0.0, 2.3.0.1, 2.3.0.0, 2.2.0.0 (constraint from non-reinstallable package requires installed instance)
[__2] fail (backjumping, conflict set: template-haskell, unordered-containers)
After searching the rest of the dependency tree exhaustively, these were the goals I’ve had most trouble fulfilling: base, hashable, yaml, unordered-containers, template-haskell, transformers, haskell-debugger, implicit-hie
Try running with --minimize-conflict-set to improve the error message.


Settings on UI:


Looks like you’re on the right track, but you should copy the install command from

cabal install haskell-debugger --allow-newer=base,time,containers,ghc,ghc-bignum,template-haskell --enable-executable-dynamic

If you are on Windows, do NOT pass —enable-executable-dynamic

Let me know if that works successfully.

Note: installation should be easier once 9.14 final is released

Thank you for the tip, .

GHCUP TUI is really powerful, and can be promoted and implemented with tips and intelligent installations and yaml generators. With a simple centralized and ambient compatible powershell UI i think all can be resolved fastly, and errors be found rapidly, but i’ve observed problems with GHCUP installation as i told, and i noticed the data to be installed is really high sized, in order of GB, probably really complex internally.

I’ve seen an hie generator, is it lacking? I’ve not added it yet.

The error remains.

System configuration:

ghcup --version
The GHCup Haskell installer, version 0.1.50.2

cabal --version
cabal-install version 3.16.0.0
compiled using version 3.16.0.0 of the Cabal library (in-tree)

haskell-debug-adapter --version
haskell-debug-adapter-0.0.42.0

ghc --version
The Glorious Glasgow Haskell Compilation System, version 9.14.0.20251104

stack not installed

hdb not installed

Visual Studio Code version 1.106.3

Visual Studio Code configuration:

Haskell Debugger plugin is installed on Visual Studio Code

Error with new command as you suggested:


command → cabal install haskell-debugger --allow-newer=base,time,containers,ghc,ghc-bignum,template-haskell

Resolving dependencies…
Error: [Cabal-7107]
Could not resolve dependencies:
[__0] trying: haskell-debugger-0.10.1.0 (user goal)
[__1] next goal: unix (dependency of haskell-debugger)
[__1] rejecting: unix; 2.8.8.0, 2.8.7.0, 2.8.6.0 (library is not buildable in the current environment, but it is required by haskell-debugger)
[__1] rejecting: unix-2.8.5.1 (conflict: haskell-debugger => unix>=2.8.6 && <2.9)
[__1] skipping: unix; 2.8.5.0, 2.8.4.0, 2.8.3.0, 2.8.2.1, 2.8.2.0, 2.8.1.1, 2.8.1.0, 2.8.0.0, 2.7.3, 2.7.2.2, 2.7.2.1, 2.7.2.0, 2.7.1.0, 2.7.0.1, 2.7.0.0, 2.6.0.1, 2.6.0.0, 2.5.1.1, 2.5.1.0, 2.5.0.0, 2.4.2.0, 2.4.1.0, 2.4.0.2, 2.4.0.1, 2.4.0.0, 2.3.2.0, 2.3.1.0, 2.3.0.0, 2.2.0.0, 2.0 (has the same characteristics that caused the previous version to fail: excluded by constraint ‘>=2.8.6 && <2.9’ from ‘haskell-debugger’)
[__1] fail (backjumping, conflict set: haskell-debugger, unix)
After searching the rest of the dependency tree exhaustively, these were the goals I’ve had most trouble fulfilling: haskell-debugger, unix

Thanks for trying this out.

You’ve found a bug in haskell-debugger! We shouldn’t depend on unix because unix doesn’t build on Windows.

We hadn’t tried this on Windows yet, sorry!

I’ve created a ticket to fix this issue (drop the dependency on unix):

And I’ve created a ticket to make sure we test building on Windows on CI, to make sure building on Windows doesn’t regress

Sorry for the trouble. I’ll try to fix this hastily and release a version without the unix dependency soon.

1 Like