<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <HTML> <HEAD> <META NAME="GENERATOR" CONTENT="SGML-Tools 1.0.6"> <TITLE>The Hugs-GHC Extension Libraries: LazyST </TITLE> <LINK HREF="libs-25.html" REL=next> <LINK HREF="libs-23.html" REL=previous> <LINK HREF="libs.html#toc15" REL=contents> </HEAD> <BODY> <A HREF="libs-25.html">Next</A> <A HREF="libs-23.html">Previous</A> <A HREF="libs.html#toc15">Contents</A> <HR> <H2><A NAME="sec:LazyST"></A> <A NAME="s15">15. LazyST </A></H2> <P> <P>This library is identical to <CODE>ST</CODE> except that the <CODE>ST</CODE> monad instance is <EM>lazy</EM>. 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. <CODE>LazyST</CODE> provides two additional operations: <P> <BLOCKQUOTE><CODE> <PRE> lazyToStrictST :: LazyST.ST s a -> ST.ST s a strictToLazyST :: ST.ST s a -> LazyST.ST s a </PRE> </CODE></BLOCKQUOTE> <P>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 <CODE>strictToLazyST</CODE> is not performed until the result of the lazy state thread it returns is demanded. <P> <HR> <A HREF="libs-25.html">Next</A> <A HREF="libs-23.html">Previous</A> <A HREF="libs.html#toc15">Contents</A> </BODY> </HTML>