[Haskell-cafe] Monads as control structures?

Creighton Hogg wchogg at lotus.hep.wisc.edu
Thu Oct 27 11:54:22 EDT 2005

so I'm a newbie getting used to Haskell.  I'm writing some 
simple things like genetic algorithms in it for practice, 
and I keep coming across something that really bugs me:  
are there any standard libraries that allow you to 
do imperative style for or while loops using monads to keep 
track of state?

I know there's things like "until", but honestly that's not 
quite what I'm looking for.  

I just think there should be a simple way to say "execute 
this block of code 10 times" without having to wrap it up in 

Haskell seems to me to be a very powerful language, and it 
looks like it should be possible to define control 
structures such as for loops using monads.

More information about the Haskell-Cafe mailing list