ST -package:sbv

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
A version of the Array interface specialized to ST. This is intended primarily so library developers can easily check whether the basic operations are unboxed properly, but its more constrained type signatures also offer somewhat better type inference where applicable.
This module includes all the features of Control.Concurrent.MVar, except that the functions in Data.Primitive.Unlifted.Weak subsume the functionality of mkWeakMV and addMVarFinalizer, so we do not include analogues of those functions.
A version of the SmallArray interface specialized to ST. This is intended primarily so library developers can easily check whether the basic operations are unboxed properly, but its more constrained type signatures also offer somewhat better type inference where applicable.
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.
State of the decoder.
An implementation of a Delay using a classical circular buffer running in the State Thread monad.