Hoogle Search

Within LTS Haskell 24.64 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. package random

    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.

  2. package criterion

    Robust, reliable performance measurement and analysis This library provides a powerful but simple way to measure software performance. It provides both a framework for executing and analysing benchmarks and a set of driver functions that makes it easy to build and run benchmarks, and to analyse their results. The fastest way to get started is to read the online tutorial, followed by the documentation and examples in the Criterion.Main module. For examples of the kinds of reports that criterion generates, see the home page.

  3. package semigroups

    Anything that associates In mathematics, a semigroup is an algebraic structure consisting of a set together with an associative binary operation. A semigroup generalizes a monoid in that there might not exist an identity element. It also (originally) generalized a group (a monoid with all inverses) to a type where every element did not have to have an inverse, thus the name semigroup.

  4. package attoparsec

    Fast combinator parsing for bytestrings and text A fast parser combinator library, aimed particularly at dealing efficiently with network protocols and complicated text/binary file formats.

  5. package http-types

    Generic HTTP types for Haskell (for both client and server code). Types and functions to describe and handle HTTP concepts. Including "methods", "headers", "query strings", "paths" and "HTTP versions".

  6. package primitive

    Primitive memory-related operations This package provides various primitive memory-related operations.

  7. package async

    Run IO operations asynchronously and wait for their results This package provides a higher-level interface over threads, in which an Async a is a concurrent thread that will eventually deliver a value of type a. The package provides ways to create Async computations, wait for their results, and cancel them. Using Async is safer than using threads in two ways:

    • When waiting for a thread to return a result, if the thread dies with an exception then the caller must either re-throw the exception (wait) or handle it (waitCatch); the exception cannot be ignored.
    • The API makes it possible to build a tree of threads that are automatically killed when their parent dies (see withAsync).

  8. package lens

    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 Internet Archive. 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: 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).

  9. package network

    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
    

  10. package data-default

    A class for types with a default value This module defines a class for types with a default value. Instances are provided for (), Data.Set.Set, Data.Map.Map, Int, Integer, Float, Double, and many others.

Page 2 of many | Previous | Next