[Haskell] ST vs State

David House dmhouse at gmail.com
Thu May 31 13:47:52 EDT 2007


On 31/05/07, Dan Weston <westondan at imageworks.com> wrote:
> I thought the types were *existentially* quantified because the
> constructor arguments were *universally* quantified. Or did I get it
> backwards?

That'd be right, if the situation actually involved constructors.
I.e., when people talk about existential types, they normally mean:

data Foo = forall a. F a

Which is isomorphic to:

data Foo = F (exists a. a)

Hence 'existential'. However, in this instance, it's just the
higher-rank polymorphism that makes things work. For further detail,
you might want to check out the Wikibook chapter on existentials (yes,
it's a stupid place for such an explanation, as I've just realised!),
which has a section on ST:

http://en.wikibooks.org/wiki/Haskell/Existentially_quantified_types#Example:_runST

-- 
-David House, dmhouse at gmail.com


More information about the Haskell mailing list