Haskell Preliminaries: Implementations and Tools

Before getting to the meat of the tutorial, I thought it would be good to provide some setup
information in a distinct, easy to find place. This short post will tell you where to find
a Haskell implementation and related tools.

Haskell Implementations

I'm testing my examples for these articles using two different Haskell implementations:

Hugs
A very nice interactive Haskell interpreter. Hugs doesn't quite implement
everything in the current Haskell specification, but it's limits shouldn't affect
anything I'll cover in this tutorial, and probably won't affect any moderate-to-large
size programs you want to write.
GHC
The Glasgow Haskell Compiler, a high performance optimizing Haskell compiler. GHC implements
every last bit of the Haskell spec, as well as a bunch of nifty extensions. It's also
got an interactive mode, called ghci which is included in its distribution.
GHC is pretty much the gold standard in Haskell implementations.

Editors and Development Environments

It's also good to have some extra tool support for Haskell programming. A lot of editors, such as
emacs, vim, and textmate provide Haskell tooling. The best tooling that I've seen is the href="http://eclipsefp.sourceforge.net/">EclipseFP feature for the href="http://www.eclipse.org">Eclipse programming environment. Admittedly, I'm a bit biased here;
I've used to lead an Eclipse-based research project, so I'm a huge Eclipse fan. But the Eclipse
Haskell support really is very nice, and it's very easy to set up. Installing Eclipse involves
nothing more than downloading it - it runs very smoothly in-place with no setup; and installing
EclipseFP can be done inside of Eclipse using the update manager - there's a complete step by step
explanation at the EclipseFP homepage linked above.

If you're a visual studio user, there's a Haskell package called href="http://www.haskell.org/visualhaskell/">Visual Haskell. I've never used it (I'm not
a windows guy; I use MacOS and Linux.), but I've heard quite good things about it.

If you prefer just using a simple text editor, vim includes the Haskell package; for emacs, you
can get a Haskell mode here. For TextMate, you can get
the Haskell bundle via the normal bundle installation route.

Miscellaneous Tools

For understanding the execution of Haskell programs, particularly when the laziness gets a bit
confusing, being able to generate an execution trace can be a huge help. There's a tool called href="http://www.haskell.org/hat/">Hat which can generate very nice, easy to follow traces for
GHC programs.

You can write fancy documentation for Haskell programs using a tool called Haddock. Haddock is something like Javadoc for
Haskell. It piggybacks on a "literate" syntax mode built-in to both GHC and Hugs, so
at least primitive support for Haddock is included in all of the Haskell tools; many also
provide additional Haddock support.

Other Documentation

The capital of the online Haskell world is the Haskell.org site. It has links to numerous other tutorials, the language spec, implementations, events, etc.

There's a Haskell blog called The Complete Sequence, which includes a weekly Haskell news update, as well as other interesting articles and links. There's another Haskell blog called Planet Haskell which also has some good material.

Tags

More like this

For this post, I'm doing a bit of an experiment. Haskell includes a "literate" syntax mode. In literate mode, and text that doesn't start with a ">" sign is considered a comment. So this entire post can be copied and used as a source file; just save it with a name ending in `".lhs"`. If this…
(This is an edited repost of one of the posts from the earlier version of my Haskell tutorial.) (This file is a literate haskell script. If you save it as a file whose name ends in ".lhs", it's actually loadable and runnable in GHCI or Hugs.) Like any other modern programming language,…
Before diving in and starting to explain Haskell, I thought it would be good to take a moment and answer the most important question before we start: **Why should you want to learn Haskell?** It's always surprised me how many people *don't* ask questions like that. Haskell is a valuable…
Way back, about three years ago, I started writing a Haskell tutorial as a series of posts on this blog. After getting to href="http://scienceblogs.com/goodmath/2007/01/haskell_a_first_step_into_mona_1.php">monads, I moved on to other things. But based on some recent philosophizing, I think I'…

The nice thing about this tutorial is that I will be able to ask dumb questions.

I've mostly used ghci myself, but one thing that has annoyed me about that is its rather unhelpful error messages. I wonder if the messages in Hugs are better. Does anyone an opinion on it?

When I tinker with Haskell I use both Hugs and ghci to help with troublesome errors. With both sets of error messages I can usually work out where I have departed from the straight and narrow.

By Tim Clark (not verified) on 28 Nov 2006 #permalink

If you're looking for a Haskell environment on windows that's relatively light-weight, what I use is a combination of SciTE and GHC.

First, grab the windows ghc installer and install it as per default. Then, go grab SciTE version 1.67 or later. (I use the installer with extensions referenced on the SciTE download page, since I use SciTE as my general-purpose text editor) Then, go grab my haskell.properties file and put it in the SciTE program directory. Edit the bottom of that file to reference what version of GHC you installed and edit the file SciTEGlobal.properties in the SciTE program directory to uncomment or add the line "import haskell" (the last fifth or so of that file is just import statements - just add "import haskell" into the list).

One thing has always really bothered me about Haskell and prevented me from using it. It has no real Read Eval Print Loop (REPL). GHCi doesn't count since it does not let you define functions. A REPL is very useful for casually playing around with the language.

Why is there this deffeciency. Ocaml does have a REPL. So is it just because Haskell has no mutable state that it cannot implement a REPL?

GHCi doesn't count since it does not let you define functions.

But it does:

Loading package base ... linking ... done.
Prelude> let f x = x + 1
Prelude> f 1
2
Prelude>