No query

Basic libraries This package contains the Standard Haskell Prelude and its support libraries, and a large collection of useful libraries ranging from data structures to parsing combinators and debugging utilities.
Fast, compact, strict and lazy byte strings with a list interface An efficient compact, immutable byte string type (both strict and lazy) suitable for binary or 8-bit character data. The ByteString type represents sequences of bytes or 8-bit characters. It is suitable for high performance use, both in terms of large data quantities, or high speed requirements. The ByteString functions follow the same style as Haskell's ordinary lists, so it is easy to convert code from using String to ByteString. Two ByteString variants are provided:
  • Strict ByteStrings keep the string as a single large array. This makes them convenient for passing data between C and Haskell.
  • Lazy ByteStrings use a lazy list of strict chunks which makes it suitable for I/O streaming tasks.
The Char8 modules provide a character-based view of the same underlying ByteString types. This makes it convenient to handle mixed binary and 8-bit character content (which is common in many file formats and network protocols). The Builder module provides an efficient way to build up ByteStrings in an ad-hoc way by repeated concatenation. This is ideal for fast serialisation or pretty printing. There is also a ShortByteString type which has a lower memory overhead and can be converted to or from a ByteString. It is suitable for keeping many short strings in memory. ByteStrings are not designed for Unicode. For Unicode strings you should use the Text type from the text package. These modules are intended to be imported qualified, to avoid name clashes with Prelude functions, e.g.
import qualified Data.ByteString as BS
An efficient packed Unicode text type. An efficient packed, immutable Unicode text type (both strict and lazy). The Text type represents Unicode character strings, in a time and space-efficient manner. This package provides text processing capabilities that are optimized for performance critical use, both in terms of large data quantities and high speed. The Text type provides character-encoding, type-safe case conversion via whole-string case conversion functions (see Data.Text). It also provides a range of functions for converting Text values to and from ByteStrings, using several standard encodings (see Data.Text.Encoding). Efficient locale-sensitive support for text IO is also supported (see Data.Text.IO). These modules are intended to be imported qualified, to avoid name clashes with Prelude functions, e.g.
import qualified Data.Text as T

ICU Support

To use an extended and very rich family of functions for working with Unicode text (including normalization, regular expressions, non-standard encodings, text breaking, and locales), see the text-icu package based on the well-respected and liberally licensed ICU library.
Assorted concrete container types This package contains efficient general-purpose implementations of various immutable container types including sets, maps, sequences, trees, and graphs. For a walkthrough of what this package provides with examples of common operations see the containers introduction. The declared cost of each operation is either worst-case or amortized, but remains valid even if structures are shared.
Concrete functor and monad transformers A portable library of functor and monad transformers, inspired by the paper This package contains:
  • the monad transformer class (in Control.Monad.Trans.Class)
  • concrete functor and monad transformers, each with associated operations and functions to lift operations associated with other transformers.
The package can be used on its own in portable Haskell code, in which case operations need to be manually lifted through transformer stacks (see Control.Monad.Trans.Class for some examples). Alternatively, it can be used with the non-portable monad classes in the mtl or monads-tf packages, which automatically lift operations introduced by monad transformers through other transformers.
Monad classes for transformers, using functional dependencies MTL is a collection of monad classes, extending the transformers package, using functional dependencies for generic lifting of monadic actions.
Platform-agnostic library for filesystem operations This library provides a basic set of operations for manipulating files and directories in a portable way.
A time library Time, clocks and calendars
Automatic testing of Haskell programs QuickCheck is a library for random testing of program properties. The programmer provides a specification of the program, in the form of properties which functions should satisfy, and QuickCheck then tests that the properties hold in a large number of randomly generated cases. Specifications are expressed in Haskell, using combinators provided by QuickCheck. QuickCheck provides combinators to define properties, observe the distribution of test data, and define test data generators. Most of QuickCheck's functionality is exported by the main Test.QuickCheck module. The main exception is the monadic property testing library in Test.QuickCheck.Monadic. If you are new to QuickCheck, you can try looking at the following resources: The quickcheck-instances companion package provides instances for types in Haskell Platform packages at the cost of additional dependencies.
Library for manipulating FilePaths in a cross platform way. This package provides functionality for manipulating FilePath values, and is shipped with GHC. It provides two variants for filepaths:
  1. legacy filepaths: type FilePath = String
  2. operating system abstracted filepaths (OsPath): internally unpinned ShortByteString (platform-dependent encoding)
It is recommended to use OsPath when possible, because it is more correct. For each variant there are three main modules: System.OsString is like System.OsPath, but more general purpose. Refer to the documentation of those modules for more information. An introduction into the new API can be found in this blog post. Code examples for the new API can be found here.
Fast JSON parsing and encoding A JSON parsing and encoding library optimized for ease of use and high performance. To get started, see the documentation for the Data.Aeson module below. (A note on naming: in Greek mythology, Aeson was the father of Jason.)
A Testing Framework for Haskell Hspec is a testing framework for Haskell. Some of Hspec's distinctive features are:
  • a friendly DSL for defining tests
  • integration with QuickCheck, SmallCheck, and HUnit
  • parallel test execution
  • automatic discovery of test files
The Hspec Manual is at https://hspec.github.io/.
Efficient Arrays An efficient implementation of Int-indexed arrays (both mutable and immutable), with a powerful loop optimisation framework . It is structured as follows: There is also a (draft) tutorial on common uses of vector.
Modern and extensible testing framework Tasty is a modern testing framework for Haskell. It lets you combine your unit tests, golden tests, QuickCheck/SmallCheck properties, and any other types of tests into a single test suite.
Efficient hashing-based container types Efficient hashing-based container types. The containers have been optimized for performance critical use, both in terms of large data quantities and high speed. The declared cost of each operation is either worst-case or amortized, but remains valid even if structures are shared. Security This package currently provides no defenses against hash collision attacks such as HashDoS. Users who need to store input from untrusted sources are advised to use Data.Map or Data.Set from the containers package instead.
Support library for Template Haskell This package provides modules containing facilities for manipulating Haskell source code using Template Haskell. See http://www.haskell.org/haskellwiki/Template_Haskell for more information.
Deep evaluation of data structures This package provides methods for fully evaluating data structures ("deep evaluation"). Deep evaluation is often used for adding strictness to a program, e.g. in order to force pending exceptions, remove space leaks, or force lazy I/O to happen. It is also useful in parallel programs, to ensure pending work does not migrate to the wrong thread. The primary use of this package is via the deepseq function, a "deep" version of seq. It is implemented on top of an NFData typeclass ("Normal Form Data", data structures with no unevaluated components) which defines strategies for fully evaluating different data types. See module documentation in Control.DeepSeq for more details.
Process libraries This package contains libraries for dealing with system processes. The typed-process package is a more recent take on a process API, which uses this package internally. It features better binary support, easier concurrency, and a more composable API. You can read more about it at https://github.com/fpco/typed-process/#readme.
HUnit support for the Tasty test framework. HUnit support for the Tasty test framework. Note that this package does not depend on HUnit but implements the relevant subset of its API. The name is a legacy of the early versions of tasty-hunit and of test-framework-hunit, which did depend on HUnit.
Lenses, Folds and Traversals This package comes "Batteries Included" with many useful lenses for the types commonly used from the Haskell Platform, and with tools for automatically generating lenses and isomorphisms for user-supplied data types. The combinators in Control.Lens provide a highly generic toolbox for composing families of getters, folds, isomorphisms, traversals, setters and lenses and their indexed variants. An overview, with a large number of examples can be found in the README. An introductory video on the style of code used in this library by Simon Peyton Jones is available from Skills Matter. A video on how to use lenses and how they are constructed is available on youtube. Slides for that second talk can be obtained from comonad.com. More information on the care and feeding of lenses, including a brief tutorial and motivation for their types can be found on the lens wiki. A small game of pong and other more complex examples that manage their state using lenses can be found in the example folder. Lenses, Folds and Traversals With some signatures simplified, the core of the hierarchy of lens-like constructions looks like: (Local Copy) You can compose any two elements of the hierarchy above using (.) from the Prelude, and you can use any element of the hierarchy as any type it linked to above it. The result is their lowest upper bound in the hierarchy (or an error if that bound doesn't exist). For instance: Minimizing Dependencies If you want to provide lenses and traversals for your own types in your own libraries, then you can do so without incurring a dependency on this (or any other) lens package at all. e.g. for a data type:
data Foo a = Foo Int Int a
You can define lenses such as
-- bar :: Lens' (Foo a) Int
bar :: Functor f => (Int -> f Int) -> Foo a -> f (Foo a)
bar f (Foo a b c) = fmap (\a' -> Foo a' b c) (f a)
-- quux :: Lens (Foo a) (Foo b) a b
quux :: Functor f => (a -> f b) -> Foo a -> f (Foo b)
quux f (Foo a b c) = fmap (Foo a b) (f c)
without the need to use any type that isn't already defined in the Prelude. And you can define a traversal of multiple fields with Control.Applicative.Applicative:
-- traverseBarAndBaz :: Traversal' (Foo a) Int
traverseBarAndBaz :: Applicative f => (Int -> f Int) -> Foo a -> f (Foo a)
traverseBarAndBaz f (Foo a b c) = Foo <$> f a <*> f b <*> pure c
What is provided in this library is a number of stock lenses and traversals for common haskell types, a wide array of combinators for working them, and more exotic functionality, (e.g. getters, setters, indexed folds, isomorphisms).
Pseudo-random number generation This package provides basic pseudo-random number generation, including the ability to split random number generators.

System.Random: pure pseudo-random number interface

In pure code, use System.Random.uniform and System.Random.uniformR from System.Random to generate pseudo-random numbers with a pure pseudo-random number generator like System.Random.StdGen. As an example, here is how you can simulate rolls of a six-sided die using System.Random.uniformR:
>>> let roll = uniformR (1, 6)        :: RandomGen g => g -> (Word, g)

>>> let rolls = unfoldr (Just . roll) :: RandomGen g => g -> [Word]

>>> let pureGen = mkStdGen 42

>>> take 10 (rolls pureGen)           :: [Word]
[1,1,3,2,4,5,3,4,6,2]
See System.Random for more details.

System.Random.Stateful: monadic pseudo-random number interface

In monadic code, use System.Random.Stateful.uniformM and System.Random.Stateful.uniformRM from System.Random.Stateful to generate pseudo-random numbers with a monadic pseudo-random number generator, or using a monadic adapter. As an example, here is how you can simulate rolls of a six-sided die using System.Random.Stateful.uniformRM:
>>> let rollM = uniformRM (1, 6)                 :: StatefulGen g m => g -> m Word

>>> let pureGen = mkStdGen 42

>>> runStateGen_ pureGen (replicateM 10 . rollM) :: [Word]
[1,1,3,2,4,5,3,4,6,2]
The monadic adapter System.Random.Stateful.runStateGen_ is used here to lift the pure pseudo-random number generator pureGen into the System.Random.Stateful.StatefulGen context. The monadic interface can also be used with existing monadic pseudo-random number generators. In this example, we use the one provided in the mwc-random package:
>>> import System.Random.MWC as MWC

>>> let rollM = uniformRM (1, 6)       :: StatefulGen g m => g -> m Word

>>> monadicGen <- MWC.create

>>> replicateM 10 (rollM monadicGen) :: IO [Word]
[2,3,6,6,4,4,3,1,5,4]
See System.Random.Stateful for more details.
A unit testing framework for Haskell HUnit is a unit testing framework for Haskell, inspired by the JUnit tool for Java, see: http://www.junit.org.
Mutable and immutable arrays In addition to providing the Data.Array module as specified in the Haskell 2010 Language Report, this package also defines the classes IArray of immutable arrays and MArray of arrays mutable within appropriate monads, as well as some instances of these classes.
Low-level networking interface This package provides a low-level networking interface.

High-Level Packages

Other packages provide higher level interfaces:
  • connection
  • hookup
  • network-simple

Extended Packages

network seeks to provide a cross-platform core for networking. As such some APIs live in extended libraries. Packages in the network ecosystem are often prefixed with network-.

network-bsd

In network-3.0.0.0 the Network.BSD module was split off into its own package, network-bsd-3.0.0.0.

network-uri

In network-2.6 the Network.URI module was split off into its own package, network-uri-2.6. If you're using the Network.URI module you can automatically get it from the right package by adding this to your .cabal file:
library
build-depends: network-uri-flag
Binary serialisation for Haskell values using lazy ByteStrings Efficient, pure binary serialisation using lazy ByteStrings. Haskell values may be encoded to and from binary formats, written to disk as binary, or sent over the network. The format used can be automatically generated, or you can choose to implement a custom format if needed. Serialisation speeds of over 1 G/sec have been observed, so this library should be suitable for high performance scenarios.