DEV Community

Philip Polkovnikov
Philip Polkovnikov

Posted on

Basic Haskell/VSCode/Windows environment in 2021

NB! This is the best I could get in 2 hours. If you know any way to improve on this, please, share!

Global setup:

  • Install latest Haskell Platform from prior versions page. Newer versions of Haskell Platform are installable only through Chocolatey and elevated command prompt, and in the end it won't work, because GHC 9 is too new and not supported by VSCode plugins.
  • Restart VSCode, if it was running. On Windows global environment variables get fixed at program startup, and extensions won't find GHC.
  • Install syntax highlighting extension.
  • Install language service client extension. The first time *.hs file is opened, it will download required language server binaries.
  • Open Msys command prompt (available as Git Bash from context menu in any folder, if Git is installed).
  • Run cabal update to download latest package version version information.
  • Run cabal install ghci-dap haskell-debug-adapter.
  • Install Haskell debugger extension.

Project setup (mostly from Haskell debugger extension readme):

  • Create a folder.
  • Run cabal init, cabal configure, and cabal bulid in it (this time regular command prompt is enough).
  • Switch to Run and Debug tab in VSCode and press Create a launch.json file link. Select haskell-debug-adapter there.
  • In toolbar select haskell(cabal) configuration.
  • Put a breakpoint and press F5 to run.

Discussion (0)