Software Tools in Haskell

Haskell is a strongly typed, pure, lazy functional programming language. That sentence should give you all the information you need to know to deal with it, although it leaves out a lot of details, including:

  • the type system (Hindly-Milner-ish, with beaucoup extensions),
  • the syntax (ML-ish), and
  • how a pure, lazy functional language does sequenced things like IO (monadically, with sugared syntax).

This is not a tutorial on Haskell. I would not presume to write one, given my level of experience. However, one problem that I have had in exploring Haskell is that, embarassingly, I could not write a program. I would find some problem that I thought would make a good, simple example, get as far as

main =

and grind to a halt.

I had read several tutorials and followed the bouncing professor through a few books. (Somewhat recommended: Paul Hudak, The Haskell School of Expression, and very recommended: Hal Daume III, "Yet Another Haskell Tutorial" (although I haven't actually finished it---192 pages and no printed copy).) The difficulty, I think, is endemic to functional programming texts: the reliance on the read-eval-print loop means that most if not all of the instruction is done with parts of programs; the exercises and examples deal with modules or small groups of functions, rather than whole, larger bodies. The result is, allegedly according to one faculty member of my acquaintance, students who "can't write programs".

[No, he was not talking about me personally, but about CS students coming from introductory classes taught using Scheme or Miranda.]

So one day, I was looking at my bookshelf and Software Tools in Pascal caught my eye. I had read the original RATFOR version of Software Tools many years ago but had not read the Pascal edition. Here was my chance, I realized, to fulfill my dream of digging into Haskell. Software Tools has a fair-sized body of self-contained, working programs that solve things that sort of look like real-world problems. I would not need to deal with both a problem domain and Haskell, and replicating the individual tools would force me to handle with the parts of Haskell that the tutorials had not really dealt with.

Thus was born Software Tools in Haskell.

The majority of the text that goes with the code largely consists of my notes (in a hopefully gramatical form). I apologize for any errors, omissions, or confusion.

A note on versions: This code was written using ghc 6.4 (originally) and 6.6.1. (I had to move to 6.6.1 because 6.4 did not include Data.ByteString in its library.) It is mostly intended to be usable with any Haskell98-ish system. Currently, the following modules are not from the standard Prelude:

  • Data.ByteString
  • Data.Array.Unboxed
  • Text.ParserCombinators.Parsec
  • Control.Monad.State
  • Control.Exception

Acknowledgements

I am very grateful to the people on the haskell-cafe mailing list who have taken the time to make very detailed comments and suggestions on what is ultimately a silly project. Specifically, I would like to thank:

  • apfelmus
  • Gwern Branwen
  • Conal Elliot
  • Benja Fallenstein
  • Neil Mitchell
  • Torsten Otto
  • Tillmann Rendel
  • Don Stewart
  • Galchin Vasili

Table of Contents

gloria i ad inferni
faciamus opus

Return to Top | About this site...
Last edited Sat Aug 8 03:29:10 2009.
Copyright © 2005-2012 Tommy M. McGuire