On Unix (Linux — Ubuntu, etc and macOS) start a terminal and type:
cd /path/to/lab # navigate to the lab's folder ghci <lab>.hs
On Windows double-click the
<lab>.hs file (make sure you are not working inside an archive!).
Inside GHCi you can enter commands like:
> 3 + 4 -- basic arithmetic 7 > length "hello" -- built-in function 5 > double 41 -- user defined function in the loaded file 82
:l <other_file>.hs loads another file (short for
:r reloads the last-loaded file – used after editing it (short for
Completion is available via
tab, command history is via
ctrl-D, cancel a command with
Installing at home
haskell.org/platform has installation instructions for Mac, Linux and Windows.
Atom offers syntax highlighting through the
rextester.com provides an online compiler, as a temporary solution.