Difference between revisions of "Example code"

From HaskellWiki
Jump to navigation Jump to search
(links)
(links)
Line 36: Line 36:
 
monadic IO, and sometimes other advanced features such as concurrency:
 
monadic IO, and sometimes other advanced features such as concurrency:
   
* [http://www.abridgegame.org/repos/darcs-unstable/PatchCommute.lhs Darcs], a revision control system (uses literate latex Haskell style)
+
* [http://www.abridgegame.org/repos/darcs-unstable/PatchCommute.lhs Darcs], a revision control system (uses literate latex Haskell style) ([http://darcs.net home])
* [http://svn.openfoundry.org/pugs/src/Pugs/Eval.hs Pugs], a perl6 implementation
+
* [http://svn.openfoundry.org/pugs/src/Pugs/Eval.hs Pugs], a perl6 implementation ([http://pugscode.org home])
* [http://www.cse.unsw.edu.au/~dons/code/yi/Yi/Core.hs Yi], a text editor
+
* [http://www.cse.unsw.edu.au/~dons/code/yi/Yi/Core.hs Yi], a text editor, ([http://www.cse.unsw.edu.au/~dons/yi.html home])
 
* [http://j.mongers.org/pub/haskell/darcs/conjure/Conjure/Torrent.hs Conjure], a bittorrent client
 
* [http://j.mongers.org/pub/haskell/darcs/conjure/Conjure/Torrent.hs Conjure], a bittorrent client
 
* [http://darcs.haskell.org/~lemmih/downNova/src/Torrent.hs DownNova], a file downloading program
 
* [http://darcs.haskell.org/~lemmih/downNova/src/Torrent.hs DownNova], a file downloading program
* [http://www.cs.york.ac.uk/fp/darcs/cpphs/Language/Preprocessor/Cpphs/Tokenise.hs cpphs], an implementation of the C preprocessor
+
* [http://www.cs.york.ac.uk/fp/darcs/cpphs/Language/Preprocessor/Cpphs/Tokenise.hs cpphs], an implementation of the C preprocessor ([http://www.cs.york.ac.uk/fp/cpphs/ home])
* [http://darcs.haskell.org/ghc/compiler/simplCore/Simplify.lhs GHC], a Haskell compiler (literate latex style)
+
* [http://darcs.haskell.org/ghc/compiler/simplCore/Simplify.lhs GHC], a Haskell compiler (literate latex style) ([http://haskell.org/ghc home])
* [http://www.augustsson.net/Darcs/Djinn/LJT.hs Djinn], a theorem prover
+
* [http://www.augustsson.net/Darcs/Djinn/LJT.hs Djinn], a theorem prover ([http://darcs.augustsson.net/Darcs/Djinn home])
* [http://darcs.haskell.org/c2hs/c2hs/c/CTrav.hs c2hs], a C to Haskell interface generator
+
* [http://darcs.haskell.org/c2hs/c2hs/c/CTrav.hs c2hs], a C to Haskell interface generator ([http://www.cse.unsw.edu.au/~chak/haskell/c2hs/ home])
* [http://www.cse.unsw.edu.au/~dons/code/lambdabot/LBState.hs Lambdabot], an IRC bot
+
* [http://www.cse.unsw.edu.au/~dons/code/lambdabot/LBState.hs Lambdabot], an IRC bot ([http://www.cse.unsw.edu.au/~dons/lambdabot.html home])
* [http://www.cse.unsw.edu.au/~dons/code/hmp3/Core.hs hmp3], an curses mp3 player
+
* [http://www.cse.unsw.edu.au/~dons/code/hmp3/Core.hs hmp3], an curses mp3 player ([http://www.cse.unsw.edu.au/~dons/hmp3.html home])
 
* [http://haskell.org/haskellwiki/Darcs_repositories More code ...]
 
* [http://haskell.org/haskellwiki/Darcs_repositories More code ...]
   

Revision as of 10:55, 22 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:

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.