Difference between revisions of "Example code"

From HaskellWiki
Jump to navigation Jump to search
(and some more)
Line 33: Line 33:
   
 
[http://www.cse.unsw.edu.au/~dons/code/lambdabot/scripts/SmallCheck.hs SmallCheck.hs]
 
[http://www.cse.unsw.edu.au/~dons/code/lambdabot/scripts/SmallCheck.hs SmallCheck.hs]
  +
  +
[http://haskell.org/haskellwiki/Darcs_repositories A large collection of online Haskell source]
   
 
=== Application code ===
 
=== Application code ===

Revision as of 06:05, 14 September 2006

To get a feel for what real world Haskell looks like, here are some examples from various popular Haskell projects.

Library code

Library code usually differs from application code: it is often highly structured, and documented with haddock, and can be rather optimised.

List.hs

Map.hs

Monad.hs

QuickCheck.hs

PrettyPrint.hs

StateT.hs

Dfa.lhs

RedBlackTree.hs

Prime.hs

Foldable.hs

ByteString.hs

Combinators.hs

SmallCheck.hs

A large collection of online Haskell source

Application code

Code from popular Haskell applications:

Darcs, a revision control system (uses literate 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

Djinn, a theorem prover

c2hs, a C to Haskell interface generator

Lambdabot, an IRC bot

hmp3, an curses mp3 player

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).

Prelude extensions: Simple things you've always wished were in the Prelude.

Gallery: Complete small programs.

Blow your mind: Short, useful, cool, magical examples, which should incite the reader's curiosity and (hopefully) lead him to a deeper understanding of advanced Haskell concepts.

Sudoku: Solvers for popular puzzle Sudoku.

NewMonads: Useful monads that are not in the main library.

PrincipalVariationSearch: Principal variation search

Shootout Entries: Examples still on the old wiki for the The Computer Language Shootout Benchmarks.