Now I’ve got back into the swing of hacking and prototyping in Haskell, I have spent some time tweaking my workflow in my editor of choice, Visual Studio Code.
The approach that I currently favour is to run GHCi in the integrated terminal and run the
:main commands to iteratively reload and run my programs. What has hobbled me a little is the (apparent) inability to directly automate this by assigning the action to a keyboard shortcut. Fortunately, it turns out that writing VSCode extensions is reasonably straightforward. So, it is with great fanfare that I announce GHCi Helper. This simple extension adds the following two commands:
ghciHelperStart: Creates a terminal and runs
stack ghciin it
:maincommands to the terminal opened with the
I can now bind a keyboard shortcut (I’m currently using
F7) to the second command and I have my rapid reload/rerun development cycle.
Content © 2023 Richard Cook. All rights reserved.