Difference between revisions of "Example code"

From HaskellWiki
Jump to navigation Jump to search
(link)
(remove uninstructive example)
Line 27: Line 27:
 
* [http://www.cse.unsw.edu.au/~dons/data/Foldable.html Foldable.hs], traversable data structures ([http://darcs.haskell.org/packages/base/Data/Foldable.hs raw])
 
* [http://www.cse.unsw.edu.au/~dons/data/Foldable.html Foldable.hs], traversable data structures ([http://darcs.haskell.org/packages/base/Data/Foldable.hs raw])
 
* [http://www.cse.unsw.edu.au/~dons/data/ByteString.html ByteString.hs], high-performance string type ([http://darcs.haskell.org/packages/base/Data/ByteString.hs raw], [http://www.cse.unsw.edu.au/~dons/fps/Data-ByteString.html docs])
 
* [http://www.cse.unsw.edu.au/~dons/data/ByteString.html ByteString.hs], high-performance string type ([http://darcs.haskell.org/packages/base/Data/ByteString.hs raw], [http://www.cse.unsw.edu.au/~dons/fps/Data-ByteString.html docs])
* [http://darcs.haskell.org/packages/ndp/Data/Array/Parallel/Stream/Flat/Combinators.hs Combinators.hs], array combinators
 
 
* [http://www.cse.unsw.edu.au/~dons/data/SmallCheck.html SmallCheck.hs], a testing framework ([http://www.cse.unsw.edu.au/~dons/code/lambdabot/scripts/SmallCheck.hs raw])
 
* [http://www.cse.unsw.edu.au/~dons/data/SmallCheck.html SmallCheck.hs], a testing framework ([http://www.cse.unsw.edu.au/~dons/code/lambdabot/scripts/SmallCheck.hs raw])
 
* [http://haskell.org/haskellwiki/Darcs_repositories More code ...]
 
* [http://haskell.org/haskellwiki/Darcs_repositories More code ...]

Revision as of 02:03, 20 September 2006

To get a feel for what real world Haskell looks like, here are some examples from various popular Haskell projects. To start learning the language, good places to start are here, here and here.

Library code

Library code usually differs from application code: it is often highly structured, and documented with haddock, and can be rather optimised. Some instructive examples (syntax highlighting by hscolour):

Application code

Code from popular Haskell applications. Such code often makes use of a monadic IO, and sometimes other advanced features such as concurrency:

  • Darcs, a revision control system (uses literate latex Haskell style)
  • Pugs, a perl6 implementation
  • Yi, a text editor
  • Conjure, a bittorrent client
  • DownNova, a file downloading program
  • cpphs, an implementation of the C preprocessor
  • GHC, a Haskell compiler (literate latex style)
  • Djinn, a theorem prover
  • c2hs, a C to Haskell interface generator
  • Lambdabot, an IRC bot
  • hmp3, an curses mp3 player
  • More code ...

Wiki examples

Here is a list of other random code collected on this wiki, replacing CodeOnTheWiki. Contributors of code to the old area are encouraged to bring their code over here. This should only be done by the original author because anything on these pages is automatically licensed under the Simple Permissive License (HaskellWiki:Copyrights).

Most examples are roughly intermediate to advanced in difficulty.