ST -package:primitive-unlifted

This module provides support for strict state threads, as described in the PLDI '94 paper by John Launchbury and Simon Peyton Jones Lazy Functional State Threads. References (variables) that can be used within the ST monad are provided by Data.STRef, and arrays are provided by Data.Array.ST.
The strict ST monad. The ST monad allows for destructive updates, but is escapable (unlike IO). A computation of type ST s a returns a value of type a, and execute in "thread" s. The s parameter is either
  • an uninstantiated type variable (inside invocations of runST), or
  • RealWorld (inside invocations of stToIO).
It serves to keep the internal states of different invocations of runST separate from each other and from invocations of stToIO. The >>= and >> operations are strict in the state (though not in values stored in the state). For example,
runST (writeSTRef _|_ v >>= f) = _|_
The lazy ST monad. The ST monad allows for destructive updates, but is escapable (unlike IO). A computation of type ST s a returns a value of type a, and executes in "thread" s. The s parameter is either
  • an uninstantiated type variable (inside invocations of runST), or
  • RealWorld (inside invocations of stToIO).
It serves to keep the internal states of different invocations of runST separate from each other and from invocations of stToIO. The >>= and >> operations are not strict in the state. For example,
runST (writeSTRef _|_ v >>= readSTRef _|_ >> return 2) = 2
The ST Monad.
The strict ST monad. The ST monad allows for destructive updates, but is escapable (unlike IO). A computation of type ST s a returns a value of type a, and execute in "thread" s. The s parameter is either
  • an uninstantiated type variable (inside invocations of runST), or
  • RealWorld (inside invocations of stToIO).
It serves to keep the internal states of different invocations of runST separate from each other and from invocations of stToIO. The >>= and >> operations are strict in the state (though not in values stored in the state). For example,
runST (writeSTRef _|_ v >>= f) = _|_
Mutable boxed and unboxed arrays in the ST monad.
TextShow instance for strict ST. Since: 2
This library provides support for strict state threads, as described in the PLDI '94 paper by John Launchbury and Simon Peyton Jones Lazy Functional State Threads. References (variables) that can be used within the ST monad are provided by Data.STRef, and arrays are provided by Data.Array.ST.
The ST Monad.
Symbolic version of the type T.
State of the decoder.
An implementation of a Delay using a classical circular buffer running in the State Thread monad.
The strict ST monad. The ST monad allows for destructive updates, but is escapable (unlike IO). A computation of type ST s a returns a value of type a, and execute in "thread" s. The s parameter is either
  • an uninstantiated type variable (inside invocations of runST), or
  • RealWorld (inside invocations of stToIO).
It serves to keep the internal states of different invocations of runST separate from each other and from invocations of stToIO. The >>= and >> operations are strict in the state (though not in values stored in the state). For example,
runST (writeSTRef _|_ v >>= f) = _|_
Unboxed mutable bit arrays in the ST monad.
Mutable histograms.