# Haskell Setup
- Install Stack by following the installation instructions
[here][StackInstall].
- I recommend using either [Atom], Vim or Emacs to edit Haskell code. Any
editor will do so long as it has decent syntax highlighting for Haskell.
Vim and Emacs come pre-installed on most UNIX operating systems (Mac +
Linux).
- Download the first homework file [Hw1.hs] and move it to a directory that
you would like to work from (e.g., `~/courses/cs225/hw`. To make sure a
directory hierarchy exists execute `mkdir -p ~/courses/cs225/hw`, to move a
file into that directory execute `mv ‹file› ~/courses/cs225/hw`, and to
navigate to that directory execute `cd ~/courses/cs225/hw`.)
- From the command line, execute `stack runghc Hw1.hs`. You should see the
following output:
>> E1 Tests: timesAfterPlus
[TEST FAILED]:
-- the input
timesAfterPlus 4 5
==
-- the output
[ERROR]: TODO
/=
-- the expected result
36
[TEST FAILED]:
-- the input
timesAfterPlus 3 4
==
-- the output
[ERROR]: TODO
/=
-- the expected result
21
[[... 71 more lines ...]]
- Next, from the command line, execute `stack ghci Hw1.hs`. You should see a
prompt that looks like:
*HW1>
Type `1 + 1` and hit enter. You should see:
*HW1> 1 + 1
2
*HW1>
Type `:q` or press `Ctrl-D` to quit out of the prompt. This is the
interactive GHC prompt, much like Python's interactive prompt which you get
by typing `python`.
- Please try to install Haskell early and ask for help if you run into any
issues. **Especially if you are planning on using Windows for this class,
get started ASAP and ask for help early.**
[StackInstall]: https://docs.haskellstack.org/en/stable/install_and_upgrade/
[Atom]: https://atom.io
[Hw1.hs]: hw/Hw1.hs