Set up a Haskell development environment with VS Code on WSL2 (Ubuntu 20.04)
This article explains how to set up a Haskell development environment with VS Code on WSL2 (Ubuntu 20.04). Also, includes useful VS Code extensions for development with Haskell.
This article explains how to set up a Haskell development environment with VS Code on WSL2 (Ubuntu 20.04).
The following lists are the table of contents about this article.
Target audience
- Those who want to set up a Haskell development environment with VS Code on WSL2 (Ubuntu 20.04).
Environment
- Windows 10 (Ver. 21H2, Build. 19044.1526)
- WSL 2 (Ubuntu 20.04 LTS)
Preconditions
- Install WSL 2 (Ubuntu 20.04 LTS) to Windows 10
- Install VS Code to WSL 2
Set up the development environment
1. Install
wget -qO- https://get.haskellstack.org/ | sh
2. Create a project
stack new [your project name]
3. Prepare to enable build the project
cd [your project name]
stack setup
stack build
4. Check setting up the development environment successful
stack exec [your project name]-exe
Setting up has been succeeded when someFunc is shown up after executing the above command.
It is like below.
$ stack exec [your project name]-exe
someFunc
5. Install VS Code extensions for development with Haskell
Finally, install the below extensions after launching VS Code
- Haskell
Haskell Syntax Highlighting is installed together - hlint
haskell-linter is installed together
That’s it!
Enjoy your development life!