Installing, Using, and Editing Haskell for CSE P505

Autumn 2016

Introduction

By the end of this, you should have:

Installation

Here are several viable choices for getting a compiler and related tools installed:

Running Haskell

In general, you can use ghci to experiment on the fly, and ghc to compile an entire file at once. For the purposes of this class, you can simply use the Makefile or simply run "ghc sourceFile.hs" to compile sourceFile.hs.

The complete manual for ghci can be found here. Some highlights:

On Windows, Dan usually uses the cygwin bash shell. If you do so, you'll see a warning that for Ctrl-C to work, you should use ghcii.sh instead of ghci. That is, uh, good advice.

Editing Haskell Files

As usual, you probably will want to use an editor with support for indentation, syntax highlighting, etc. Because we are writing short programs for homework purposes, we do not need lots of modern features (e.g., auto-completion), but that may be a matter of taste.

It appears the most widely supported editor platform for Haskell is Emacs (which does have Windows installation options). The Haskell IDE page lists other alternatives; we have heard that Sublime Text (which supports Windows) has particularly good support for Haskell. Atom (by Github) is another cross-platform editor with a Haskell module. That said, the only solution known to work by Dan and John is to use haskell-mode with Emacs.

So... steps for using Emacs to edit Haskell files:


Valid CSS! Valid XHTML 1.1