HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Modulemonad-par-extras-0.3.3Haskell98

Control.Monad.Par.State

This module provides a notion of (Splittable) State that is compatible with any Par monad.

This module provides instances that make StateT-transformed monads into valid Par monads.

  • 1 class
classclass SplittableState a where
#

A type in SplittableState is meant to be added to a Par monad using StateT. It works like any other state except at fork points, where the runtime system splits the state using splitState.

Common examples for applications of SplittableState would include (1) routing a splittable random number generator through a parallel computation, and (2) keeping a tree-index that locates the current computation within the binary tree of forks. Also, it is possible to simply duplicate the state at all fork points, enabling "thread local" copies of the state.

The limitation of this approach is that the splitting method is fixed, and the same at all fork points.

Methods

Instances2SplittableState
  • SplittableState PedigreeDefined in monad-par-extras-0.3.3 · Control.Monad.Par.Pedigree
  • RandomGen g => SplittableState gDefined in monad-par-extras-0.3.3 · Control.Monad.Par.RNG · orphan

    Trivial instance.

Orphan instances

4 instances