[Haskell] ST vs State

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Thu May 31 03:59:31 EDT 2007


Am Mittwoch, 30. Mai 2007 14:09 schrieb Brandon S. Allbery KF8NH:
> On May 30, 2007, at 5:59 , Federico Squartini wrote:
> > I suppose there is something "under the hood" which makes them
> > different, but I cannot figure out what.
>
> For one thing, ST uses existential types to prevent values from
> leaking outside the monad.

ST uses universally-quantified types.

Also note that an important difference between State and ST is that State can 
be implemented in pure Haskell while ST has to be hard-wired into the 
compiler/interpreter or implemented in Haskell using unsafe features.

Best wishes,
Wolfgang


More information about the Haskell mailing list