HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulemonad-par-extras-0.3.3Haskell98

Control.Monad.Par.AList

Deprecated. This structure does not perform well, and will be removed in future versions

This module defines the AList type, a list that supports constant-time append, and is therefore ideal for building the result of tree-shaped parallel computations.

  • 1 type
  • 20 values

The AList type and operations

12 declarations
datadata AList a
#

List that support constant-time append (sometimes called join-lists).

Constructors

Instances4Eq, Show, NFData, Serialize
  • Eq a => Eq (AList a)Defined in monad-par-extras-0.3.3 · Control.Monad.Par.AList
  • Show a => Show (AList a)Defined in monad-par-extras-0.3.3 · Control.Monad.Par.AList
  • NFData a => NFData (AList a)Defined in monad-par-extras-0.3.3 · Control.Monad.Par.AList
  • Serialize a => Serialize (AList a)Defined in monad-par-extras-0.3.3 · Control.Monad.Par.AList
valuehead :: AList a -> a
#

O(n) take the head element of an AList

NB. linear-time, because the list might look like this:

(((... `append` a) `append` b) `append` c)

Regular (non-parallel) Combinators

3 declarations

Operations to build ALists in the Par monad

4 declarations
valueparBuildThresh
  1. :: (NFData a, ParFuture f p)
  2. => Int
  3. -> InclusiveRange
  4. -> Int -> a
  5. -> p (AList a)
#

A parMap over an AList can result in more balanced parallelism than the default parMap over Traversable data types. parMap :: NFData b => (a -> b) -> AList a -> Par (AList b)

Build a balanced AList in parallel, constructing each element as a function of its index. The threshold argument provides control over the degree of parallelism. It indicates under what number of elements the build process should switch from parallel to serial.

Inspect and modify the internal structure of an AList tree

2 declarations