How to interact with my project via ghci in VS Code

As a Haskell Beginner I am trying to switch from Emacs to VS Code.

In Emacs I can start an “Inf-Haskell” buffer with ghci running and via :l haskell-file.hs interact with my code. How can I do something similar in VS Code?

In VS Code I have installed the Haskell.haskell extension which gives me great code completion, but I cannot figure out how I start a project REPL in VS Code. My project runs under stack.

Thanks heaps for pointers!

1 Like

Depending on your needs, the easiest might be the ‘evaluate code snippets’ feature of HLS (included in the haskell plugin for VS Code). That is not really a REPL, but it covers most of the same functionality. If you really need a repl, I think the easiest way is just to open a terminal and run ghci in there.

1 Like

Thanks. I’ll try this out.

Is the plugin installed by default? How can I activate it in VS Code?

It’s part of the Haskell.haskell extension. You do need to use a supported GHC version which include 8.10.7, 9.0.2, and partially 9.2.2 and 9.2.3 (the partial support does include the code snippet evaluation part).

1 Like