Difference between revisions of "How to write a Haskell program"

From HaskellWiki
Jump to navigation Jump to search
(more notes)
(details on hosting)
Line 27: Line 27:
 
* Tag each release
 
* Tag each release
 
* Make sure you also release tarballs, '''darcs dist''' can do this automatically
 
* Make sure you also release tarballs, '''darcs dist''' can do this automatically
  +
  +
== Hosting ==
  +
  +
Source can be hosted on darcs.haskell.org (currently you need to email
  +
Simon Marlow to do this). Also, haskell.org itself has some user
  +
accounts available. Finally, there is SourceForge and other online/free
  +
sites.
  +
  +
== Web page ==
  +
  +
Create a web page documenting your project! An easy way to do this is to
  +
add a project specific page to [[Haskell|the Haskell wiki]]
   
 
== Build system ==
 
== Build system ==

Revision as of 02:03, 30 October 2006

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

Hosting

Source can be hosted on darcs.haskell.org (currently you need to email Simon Marlow to do this). Also, haskell.org itself has some user accounts available. Finally, there is SourceForge and other online/free sites.

Web page

Create a web page documenting your project! An easy way to do this is to add a project specific page to the Haskell wiki

Build system

Use 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

The best code in the world is meaningless if nobody knows about it:

  • Announce your project releases to haskell@haskell.org! This ensure it will then make it into the Haskell Weekly News. To be doubly sure, you should CC the release to the HWN editor
  • Blog about it, on Planet Haskell
    • Write about it on your blog
    • Then email the Planet Haskell maintainer (ibid on #haskell) the RSS feed url for your blog
  • Add your library or tool to the Libraries and tools page, under the relevant category, so people can find it.