How to write a Haskell program

From HaskellWiki
Revision as of 23:06, 26 October 2006 by DonStewart (talk | contribs) (link)
Jump to navigation Jump to search

A guide to the best practice for creating a new Haskell project or program.

Structure

The basic structure of a new Haskell project can be adopted from HNop, the minimal Haskell project.

Licenses

Library code for the base libraries must be BSD licensed. Otherwise, it is your call. Choose a licence (inspired by this). Check licence of things you use, both other Haskell packages and C libraries. Use same as related where possible. Haskell community is split into 2 camps, roughly, those who release everything under BSD, and GPLers. We recommend avoiding LGPL, due to cross module optimisation issues.

Revision control

Use Darcs unless you hve a specific reason not to. Almost all new Haskell projects are released under Darcs, and this benefits everyone -- a set of common tools increases productivity, and you're more likely to get patches.

Advice:

  • Tag each release
  • Make sure you also release tarballs, darcs dist can do this automatically

Build system

Ues Cabal.

Documentation

Use Haddock.

Testing

Pure code can be tested using QuickCheck. Impure code with HUnit.

Program structure

Monad transformers are very useful for programming in the large, encapsulating state, and controlling side effects.

Publicity