This library is identical to ST
except that the ST
monad
instance is lazy. The lazy ST monad tends to be more prone to
space leaks than the strict version, so most programmers will use the
former unless laziness is explicitly required. LazyST
provides
two additional operations:
lazyToStrictST :: LazyST.ST s a -> ST.ST s a
strictToLazyST :: ST.ST s a -> LazyST.ST s a
These are used to convert between lazy and strict state threads. The
semantics with respect to laziness are as you would expect: the strict
state thread passed to strictToLazyST
is not performed until the
result of the lazy state thread it returns is demanded.