strict vs. lazy state threads
Hello, http://haskell.org/ghc/docs/latest/html/libraries/base/Control.Monad.ST.html says about the module Control.Monad.ST: This library provides support for strict state threads, as described in the PLDI '94 paper by John Launchbury and Simon Peyton Jones Lazy State Threads. I cannot find a paper Lazy State Threads in the list of papers on Simon Peyton Jones' website but I assume that the library documentation refers to Lazy *Functional* State Threads. The problem is that I cannot find an exact specification about what strict and lazy means in conjunction with state threads. I thought that the (only) difference between strict and lazy state threads is that with strict state threads the result is _|_ if the final state is _|_ while with lazy state threads the result may be non-_|_ even if the final state is _|_. Operationally, this would mean that with strict state threads the final state would always be demanded which wouldn't be true for lazy state threads. Is this correct? But if it's correct, I don't understand why the library documentation claims that the above-mentioned paper describes strict state threads since from my studies of the paper I came to the conclusion that it describes lazy state threads. Any helpful comments are appreciated. Regards, Wolfgang
Wolfgang Jeltsch <wolfgang@jeltsch.net> writes:
The problem is that I cannot find an exact specification about what strict and lazy means in conjunction with state threads.
This example shows a difference: import Control.Monad.ST.Strict -- try Lazy instead of Strict example :: (forall s . ST s Int) example = do undefined return 0 main = print (runST example)
participants (2)
-
Albert Lai -
Wolfgang Jeltsch