# Tutorial 01 – Installing Stack and VSCode
This tutorial will cover installing Haskell Stack and Microsoft Visual Studio Code.
# Stack
Stack is an easy to use toolkit for creating Haskell based software. It is not an IDE but a suite of tools for creating isolated GHC installations and managing dependencies (similar Python’s “`virtualenv“`), and for building, executing, testing, and benchmarking your Haskell software.
Stack has an amazing document repository available on their [Read the Docs Official Website](https://docs.haskellstack.org/en/stable/README/). It has an [Installation Guide](https://docs.haskellstack.org/en/stable/README/#how-to-install), [Quickstart Guide](https://docs.haskellstack.org/en/stable/README/#quick-start-guide), [User Guide](https://docs.haskellstack.org/en/stable/GUIDE/), and much more!
## Installing Stack
Please follow the related instructions to your operating system.
### Windows
Run the [Stack installer](https://get.haskellstack.org/stable/windows-x86_64-installer.exe) executable file and follow the on-screen steps. While going through the installer, don’t change any of the default settings. The default settings will ensure that “stack” is available in your PATH, and hence usable in your PowerShell.
#### Confirm Installation
To confirm you’ve successfully installed stack, press the four-flagged Windows key, search for “`PowerShell“`, and click the Windows PowerShell application that shows up. A blue/black window should pop up. Finally, to confirm that “stack” has been successfully installed, type in “`stack –help“` into the powershell window. If some manual information appears, then you have successfully installed stack! Otherwise, you will need to go through these steps again.
### Mac
For Mac users, open up the terminal (Apple logo + Space, then search “Terminal”), and run:
“`
xcode-select –install
“`
Finally, run
“`
curl -sSL https://get.haskellstack.org/ | sh
“`
(from [Official Stack Webpage](https://docs.haskellstack.org/en/stable/README/)) inside the terminal window. This will fully install Stack. It might ask you for permissions while installing, this is normal, please give it permission.
#### Using homebrew (Alternative)
If you prefer to use Homebrew to install Stack, please run
“`
brew install haskell-stack
“`
However, the homebrew Stack package is unofficial and may not be up-to-date.
#### Confirm Installation
To confirm you’ve successfully installed stack, you should run “`stack –help“` in your terminal window. If some manual information appears, then you have successfully installed stack! Otherwise, you will need to go through these steps again.
### Linux
For Linux users, please run
“`
curl -sSL https://get.haskellstack.org/ | sh
“`
(from [Official Stack Webpage](https://docs.haskellstack.org/en/stable/README/)) inside a terminal window. This will fully install Stack. It might ask you for permissions while installing, this is normal, please give it permission.
#### Confirm Installation
To confirm you’ve successfully installed stack, you should run “`stack –help“` in your terminal window. If some manual information appears, then you have successfully installed stack! Otherwise, you will need to go through these steps again.
## Quickstart
### Simple 1 file project
If you want to develop a simple 1 file project, please:
1. Create a new Haskell file (ending in “`.hs“` [or “`.lhs“` if you want to use literate Haskell]) in a directory you are familiar with. Please fill in the file with some code.
2. Open up a terminal/PowerShell window
3. In your terminal window, `cd` to the directory containing the file (e.g., “`cd ~/Documents/MyProject/“`)
4. If you’d like to build your Haskell file, please run “`stack ghc
### Standard Project
If you’d like to create a standard software project (with out of the box support for package management, building, running, testing, and benchmarking), please:
1. Open up a terminal/PowerShell window.
2. Navigate to a directory you would like to contain your software (e.g., “`cd ~/Documents/Programming/“` if you have a Programming folder in your Documents folder).
3. Run “`stack new
4. Navigate into your newly created project (e.g., “`cd
* To run your project, run “`stack run“`
* To test your project, run “`stack test“`
* To build your project, run “`stack build“`
* To add a dependency to your project, edit your “`project.yaml“` file, specifically under the dependencies list, add the name of your desired dependency (it will be a package name, e.g., “QuickCheck”). Afterwards, you should be able import files from your source code files. See below for an example:
“`
dependencies:
– base >= 4.7 && < 5
- QuickCheck # adding dependency on QuickCheck
- SomeOtherPackageIWantToUseInMyProject
```
# VSCode
## Installing VSCode
Please download the binary related to your operating system from the [Official VSCode Downloads webpage](https://code.visualstudio.com/Download). Then please follow the related installation instructions for your operating system.
### Windows
Please run the executable from the above download link and follow the on-screen steps. You will need to just accept their EULA. Please leave all of the options along the installation default.
### Mac
Once you've downloaded the zip file from the above download link, please open up the zip file and drag-and-drop the internal ```Visual Studio Code.app``` file into your ```Applications``` folder.
## Installing Haskell support
1. Open up VSCode
2. Press CTRL+SHIFT+X to open up the Extensions menu (if nothing opens on the left side of your screen, press View > Extensions at the top bar)
3. In the menu created on the left-hand side of your screen, search for “Haskell”
4. Click on the found item called “Haskell” (there will be many items but we’re looking for just “Haskell”). At time of writing, it’s currently version 1.2.0 and the author is “Haskell”.
5. Press “Install”. While installing, a little pop up might appear at the bottom right of your screen indicating the progress of the installation (and the installation of the dependencies).
This is all you need to do install Haskell support in VSCode. Now, when opening up files and folders, Haskell syntax should be highlighted nicely.
## Using the terminal/PowerShell in VSCode
With VSCode open, please press CTRL+SHIFT+` (or alternatively, press Terminal > New Terminal). It will open up a terminal window in the bottom of your screen.