[Haskell-cafe] Re: [Haskell] ST vs State

Bulat Ziganshin bulat.ziganshin at gmail.com
Wed May 30 15:11:52 EDT 2007


Hello Federico,

Wednesday, May 30, 2007, 12:54:35 PM, you wrote:

> Control.Monad.ST
> And
> Control.Monad.State

ST monad is just reduced IO monad which like IO organizes sequential
(imperative) ordr of execution but unlike IO supports only a small
closed set of operations - those working with STRef and STArray

State monad provides just two operations - get and put, which provides
access to some "monad state". unlike ST/IO monads operations in State
monad (and all other monads) can be performed in any order as typical
for lazy computations. of course, there are guarantees that put
operation will be performed before get that reads appropriate state

you may be interested looking at http://haskell.org/haskellwiki/IO_inside
although it doesn't say about ST/State monads directly

(btw, there is also Lazy.ST monad but it is not used too much :)


-- 
Best regards,
 Bulat                            mailto:Bulat.Ziganshin at gmail.com



More information about the Haskell-Cafe mailing list