difference between (evaluate . runST) and stToIO

Simon Peyton-Jones simonpj@microsoft.com
Wed, 28 Aug 2002 12:20:33 +0100


They aren't identical. =20

runST guarantees to run a complete state thread that can't interact
with any other.  stToIO runs some imperative actions that might=20
interact with other stToIO calls.

You might find it helpful to read 'State in Haskell' if you havn't
already done so.

Simon

| -----Original Message-----
| From: Hal Daume III [mailto:hdaume@ISI.EDU]=20
| Sent: 06 August 2002 18:55
| To: Haskell Mailing List
| Subject: difference between (evaluate . runST) and stToIO
|=20
|=20
| I can't seem to figure out what the difference is between using
|=20
|   evaluate (runST action)
|=20
| and
|=20
|   stToIO action
|=20
| when in the IO monad and running something in ST...they seem=20
| to behave identically...are they?
|=20
| If they are, why do they have different type signatures (one=20
| is ST RealWorld a -> IO a, while the other is (forall s. ST s=20
| a) -> IO a)?
|=20
|  - Hal
|=20
| --
| Hal Daume III
|=20
|  "Computer science is no more about computers    | hdaume@isi.edu
|   than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume
|=20
| _______________________________________________
| Haskell mailing list
| Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell
|=20