The Haskell Phrasebook

The Haskell Phrasebook is a free quick-start Haskell guide comprised of a sequence of small annotated programs. It provides a cursory overview of selected Haskell features, jumping-off points for further reading, and recommendations to help get you writing programs as soon as possible.

Source code

To follow along and run the code examples, get the source files from github.com/typeclasses/haskell-phrasebook.

Libraries

Here is the complete list of libraries utilized by the example programs:

  • base is the standard library, required by every Haskell program.

  • We use Seq whenever we will need to retrieve a value from a particular position in a list.

  • hashable provides the Hashable class for types that can be used as keys in hash maps.

  • We use stm (“software transactional memory”) for all mutable references and inter-thread communication.

  • We use time for holding time in the palm of our hands.

  • We use mwc-random to generate pseudo-random numbers (MWC stands for “multiply-with-carry”).

  • cryptonite serves all of our cryptography needs.

  • We represent byte arrays using the ByteString type from the bytestring library.

  • We use some utilities from the memory library for working with byte arrays.

  • We use the utf8-string library for conversions between ByteString and String using the UTF-8 character encoding.