[Haskell-cafe] Re: Total Functional Programming in Haskell

wren ng thornton wren at freegeek.org
Sat Oct 4 19:49:22 EDT 2008


David Menendez wrote:
> On Wed, Oct 1, 2008 at 7:53 PM, wren ng thornton <wren at freegeek.org> wrote:
>> [1] Just like existential types, you can put something in but you can never
>> get it back out again. For inescapable monads like IO and ST, this is why
>> they have the behavior of sucking your whole program into the existential
>> black-hole.
> 
> That's true for IO, but the whole point of ST is that it *is*
> escapable. What makes ST (and IO and STM) unusual is that it can't be
> implemented in pure Haskell without special support from the run-time
> system.

I suppose it depends on definitions. Certainly you can runST it to get 
an end result out, but doing so looses the internal structure (STRefs) 
which cannot be reclaimed. To me this makes ST a world apart from State, 
[], Maybe, and other monads which you can freely escape and reenter. 
Perhaps it would've been better to say that ST is not, er, reentrant.

-- 
Live well,
~wren


More information about the Haskell-Cafe mailing list