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-0.3.6Haskell98

Control.Monad.Par.Scheds.Trace

This is the scheduler described in the paper "A Monad for Deterministic Parallelism". It is based on a lazy Trace data structure that separates the scheduler from the Par monad method implementations.

  • 3 types
  • 13 values
  • Packagemonad-par-0.3.6
  • Exports16
  • LanguageHaskell98
  • LicenceBSD-3-Clause
  • SourceTrace.hs
newtypenewtype Par a
#
Instances6Monad, Functor, MonadFix, Applicative, ParFuture, ParIVar
  • Monad ParDefined in monad-par-0.3.6 · Control.Monad.Par.Scheds.TraceInternal
  • Functor ParDefined in monad-par-0.3.6 · Control.Monad.Par.Scheds.TraceInternal
  • MonadFix ParDefined in monad-par-0.3.6 · Control.Monad.Par.Scheds.TraceInternal
  • Applicative ParDefined in monad-par-0.3.6 · Control.Monad.Par.Scheds.TraceInternal
  • ParFuture IVar ParDefined in monad-par-0.3.6 · Control.Monad.Par.Scheds.Trace · orphan
  • ParIVar IVar ParDefined in monad-par-0.3.6 · Control.Monad.Par.Scheds.Trace · orphan
valuerunPar :: Par a -> a
#

Run a parallel, deterministic computation and return its result.

Note: you must NOT return an IVar in the output of the parallel computation. This is unfortunately not enforced, as it is with runST or with newer libraries that export a Par monad, such as lvish.

valuerunParIO :: Par a -> IO a
#

A version that avoids an internal unsafePerformIO for calling contexts that are already in the IO monad.

Returning any value containing IVar is still disallowed, as it can compromise type safety.

newtypenewtype IVar a
#
Instances6ParFuture, ParIVar, Eq, NFData
  • ParFuture IVar ParIODefined in monad-par-0.3.6 · Control.Monad.Par.IO
  • ParFuture IVar ParDefined in monad-par-0.3.6 · Control.Monad.Par.Scheds.Trace · orphan
  • ParIVar IVar ParIODefined in monad-par-0.3.6 · Control.Monad.Par.IO
  • ParIVar IVar ParDefined in monad-par-0.3.6 · Control.Monad.Par.Scheds.Trace · orphan
  • Eq (IVar a)Defined in monad-par-0.3.6 · Control.Monad.Par.Scheds.TraceInternal

    Equality for IVars is physical equality, as with other reference types.

  • NFData (IVar a)Defined in monad-par-0.3.6 · Control.Monad.Par.Scheds.TraceInternal
valuenewFull_ :: a -> Par (IVar a)
#

Creates a new IVar that contains a value (head-strict only)

valueget :: IVar a -> Par a
#

Read the value in an IVar. The get operation can only return when the value has been written by a prior or parallel put to the same IVar.

valueput :: NFData a => IVar a -> a -> Par ()
#

Put a value into an IVar. Multiple puts to the same IVar are not allowed, and result in a runtime error.

put fully evaluates its argument, which therefore must be an instance of NFData. The idea is that this forces the work to happen when we expect it, rather than being passed to the consumer of the IVar and performed later, which often results in less parallelism than expected.

Sometimes partial strictness is more appropriate: see put_.

valueput_ :: IVar a -> a -> Par ()
#

Like put, but only head-strict rather than fully-strict.

valuefixPar :: (a -> Par a) -> Par a
#

Take the monadic fixpoint of a Par computation. This is the definition of mfix for Par. Throws FixParException if the result is demanded strictly within the computation.

Orphan instances

2 instances