Safe Haskell | Unsafe |
---|
This module is not Safe Haskell; as an end-user, you shouldn't ever need to import it.
It is exposed only because it is necessary for implementing new LVar types that will live in their own, separate packages.
- newtype Par where
- newtype LVar s all delt = WrapLVar {
- unWrapLVar :: LVar all delt
- data Determinism
- type QPar = Par QuasiDet
- unWrapPar :: Par d s a -> Par a
- unsafeRunPar :: Par d s a -> a
- unsafeConvert :: Par d1 s1 a -> Par d2 s2 a
- unsafeDet :: Par d1 s a -> Par d2 s a
- state :: LVar s a d -> a
- liftIO :: IO a -> Par d s a
- dbgLvl :: Int
Type-safe wrappers around internal components
The type of parallel computations. A computation Par d s a
may or may not be
deterministic based on the setting of the d
parameter (of kind Determinism
).
The s
parameter is for preventing the escape of LVar
s from Par
computations
(just like the ST
monad).
Implementation note: This is a wrapper around the internal Par
type, only with more type parameters.
newtype LVar s all delt Source
The generic representation of LVars used by the scheduler. The end-user can't actually do anything with these and should not try to.
WrapLVar | |
|
data Determinism Source
This datatype is promoted to type-level (DataKinds
extension)
and used to indicate whether a Par
computation is
guaranteed-deterministic, or only quasi-deterministic (i.e., might
throw NonDeterminismExn
).
Unsafe conversions and lifting
unWrapPar :: Par d s a -> Par aSource
Unsafe: drops type information to go from the safe Par
monad to
the internal, dangerous one.
unsafeRunPar :: Par d s a -> aSource
This is cheating! It pays no attention to session sealing (s
) or to the
determinism level (d
).
unsafeConvert :: Par d1 s1 a -> Par d2 s2 aSource
Ignore the extra type annotations regarding both determinism and session-sealing.
unsafeDet :: Par d1 s a -> Par d2 s aSource
Unsafe coercion from quasi-deterministic to deterministic. The user is promising that code is carefully constructed so that put/freeze races will not occur.
state :: LVar s a d -> aSource
Extract the state of an LVar. This should only be used by implementations of new LVar data structures.
Debugging information taken from the environment
Debugging flag shared by several modules.
This is activated by setting the environment variable DEBUG=1..5
.
By convention DEBUG=100
turns on full sequentialization of the program and
control over the interleavings in concurrent code, enabling systematic debugging
of concurrency problems.