Remi Turk wrote:
MonadState needs multi-parameter type classes, State and StateT don't. And ST needs rank-2 types (or at least one rank-2 constant) and, to be implemented _efficiently_, also needs something like unsafePerformIO (or even lower-level unsafe mutable state primitives).
I think one could call the ST monad a safe yet still efficient variant of unsafePerformIO + IORef's + IOArray's.
No, the point of ST is that it is safe (as opposed to unsafePerformIO), but still has the advantages of being both efficient and allowing purely functional encapsulation via runST (as oppesed to IORefs and IOArrays). The only price is that you need rank-2 polymorphism and new language primitives for creating, reading and writing references. But using these primitives is much better than using unsafePerformIO - the latter entails a lot of harmful things. -- Till Mossakowski Phone +49-421-218-4683 Dept. of Computer Science Fax +49-421-218-3054 University of Bremen [EMAIL PROTECTED] P.O.Box 330440, D-28334 Bremen http://www.tzi.de/~till _______________________________________________ Haskell mailing list Haskell@haskell.org http://www.haskell.org/mailman/listinfo/haskell