Personal tools

Example code

From HaskellWiki

(Difference between revisions)
Jump to: navigation, search
(links)
(link internally now)
Line 13: Line 13:
   
 
* [http://www.cse.unsw.edu.au/~dons/data/Prelude.html A Haskell 98 Prelude.hs], foundational Haskell library ([http://www.cse.unsw.edu.au/~dons/data/Prelude.hs raw], [http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html docs])
 
* [http://www.cse.unsw.edu.au/~dons/data/Prelude.html A Haskell 98 Prelude.hs], foundational Haskell library ([http://www.cse.unsw.edu.au/~dons/data/Prelude.hs raw], [http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html docs])
* [http://www.cse.unsw.edu.au/~dons/data/Basics.html Unix.hs], simple unix tools, for beginner Haskellers ([http://www.cse.unsw.edu.au/~dons/data/Basics.hs raw])
+
* [[Simple_unix_tools|Unix.hs]], simple unix tools, for beginner Haskellers ([http://www.cse.unsw.edu.au/~dons/data/Basics.hs raw])
 
* [http://www.cse.unsw.edu.au/~dons/data/List.html List.hs], the standard list library ([http://www.cse.unsw.edu.au/~dons/data/List.hs raw], [http://haskell.org/ghc/docs/latest/html/libraries/base/Data-List.html docs])
 
* [http://www.cse.unsw.edu.au/~dons/data/List.html List.hs], the standard list library ([http://www.cse.unsw.edu.au/~dons/data/List.hs raw], [http://haskell.org/ghc/docs/latest/html/libraries/base/Data-List.html docs])
 
* [http://www.cse.unsw.edu.au/~dons/data/Maybe.html Maybe.hs], the <code>Maybe</code> type ([http://www.cse.unsw.edu.au/~dons/data/Maybe.hs raw], [http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Maybe.html docs])
 
* [http://www.cse.unsw.edu.au/~dons/data/Maybe.html Maybe.hs], the <code>Maybe</code> type ([http://www.cse.unsw.edu.au/~dons/data/Maybe.hs raw], [http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Maybe.html docs])

Revision as of 16:54, 23 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.

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.