Personal tools

Example code

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(Wiki examples: Link updates)
m (Wiki examples: Link update)
Line 62: Line 62:
 
* [[Prelude extensions]]: Simple things you've always wished were in the Prelude.
 
* [[Prelude extensions]]: Simple things you've always wished were in the Prelude.
 
* [[Gallery]]: Complete small programs.
 
* [[Gallery]]: Complete small programs.
* [[Blow_your_mind|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.
+
* [[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 [http://en.wikipedia.org/wiki/Sudoku Sudoku]
 
* [[Sudoku]]: Solvers for popular puzzle [http://en.wikipedia.org/wiki/Sudoku Sudoku]
 
* [[New monads]]: Useful monads that are not in the main library.
 
* [[New monads]]: Useful monads that are not in the main library.
* [[PrincipalVariationSearch]]: Principal variation search
+
* [[Principal variation search]]
* [[Great_language_shootout|Great Language Shootout]]: Examples still on the old wiki for the [http://shootout.alioth.debian.org/index.php The Computer Language Shootout Benchmarks].
+
* [[Great language shootout]]: Examples still on the old wiki for the [http://shootout.alioth.debian.org/index.php The Computer Language Shootout Benchmarks].
 
* [http://www.informatik.uni-bonn.de/~ralf/ Ralf Hinze] maintains a [http://www.informatik.uni-bonn.de/~ralf/software.html Haskell software page]
 
* [http://www.informatik.uni-bonn.de/~ralf/ Ralf Hinze] maintains a [http://www.informatik.uni-bonn.de/~ralf/software.html Haskell software page]

Revision as of 18:33, 7 October 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.

1 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):

2 Application code

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

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