[Haskell-cafe] simple state monad exercises? (besides labeling trees)

John Meacham john at repetae.net
Tue Jul 7 22:29:22 EDT 2009

On Mon, Jul 06, 2009 at 12:54:54PM -0400, Thomas Hartman wrote:
> Can someone give some simple common scenarios where the state monad is
> useful, besides labeling trees?

Implementing the Union-Find data structure[1] for unification based type
inference. As far as I know, no good alternative exists that has the
same very low computational complexity of the true stateful
union-find. Also, it's computational complexity has the ackermann's
function in it, which is just neat.


[1] http://en.wikipedia.org/wiki/Disjoint-set_data_structure

John Meacham - ⑆repetae.net⑆john⑈ - http://notanumber.net/

More information about the Haskell-Cafe mailing list