Inline execution in VScode

When writing haskell code you must always have a terminal with ghci open. With a screen as small as a notebook screen it can be inconvenient.
Is there an extension for VScode that allows inline execution? I am looking for something like julia in VScode or python (with hydrogen) in Atom.

1 Like

The Haskell Language Server allows you to write comments like this:

-- >>> 1 + 1

Then it shows a link to evaluate the expression above it.

See Features — haskell-language-server 2.4.0.0 documentation

9 Likes

Is there something that by selecting lines of code and typing ctrl+enter compiles, executes and displays the result inline? possibly choosing the level of compilation optimization?

AFAIK no.
It would be relatively simple to write such an extension (I did it for the Chez Scheme REPL). The biggest problem is actually parsing the selected code to try and only send syntactically valid pieces of code. And the fact that VS Code does not allow multi-line text decorations to display the result of the evaluation inline, it only displays it on hover.

2 Likes