5 Oct
Running
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 :load
) .
:r
reloads the last-loaded file – used after editing it (short for :reload
).
Completion is available via tab
, command history is via ↑
and ↓
.
Exit with ctrl-D
, cancel a command with ctrl-C
.
Installing at home
haskell.org/platform has installation instructions for Mac, Linux and Windows.
Atom offers syntax highlighting through the haskell-language
plugin.
rextester.com provides an online compiler, as a temporary solution.