But they are very similar! At least superficially.
They are both based on the notion of state transformer. Moreover in
the original paper about the ST monad:
http://www.dcs.gla.ac.uk/fp/papers/lazy-functional-state-threads.ps.Z
The authors say:
"In this paper we describe a way to express statef
Hello dear Haskellers,
Could someone be kind and explain with some detail what are the
differences between the two monads:
Control.Monad.ST
And
Control.Monad.State
?
They are both meant to model stateful computation but they are not the
same monad. The first one represents state with in place u
Thanks for the hints. It's a pity that (as far as I know) no one has
written a tutorial on those techniques, because I think it would be
appreciated. Some of them are quite involved and learning them just by
reading code is very time consuming.
Federico
__
Sorry, I was very silly!
This is the correct version of the program using the doFromto loop.
And it runs fast! I hope there are no further mistakes.
Thanks Axel.
time ./IOMutUnbUnsafe
499
real0m0.708s
user0m0.573s
sys 0m0.008s
--
Of course I know that the list version is very unfair, but I wanted to see
what was the trade off between elegance and speed.
Regarding whether low level programming makes sense or not, I was just
curious to see what are the limits of Haskell. Moreover there is not much
literature on high performa
I was reading an old post where Hal Daume III was analyzing Haskell
performance for arrays.
He proposed a test program which initializes an array, reverse it a number
of times, and sums the contents.
So I wrote a c++ reference program, a naive haskell version using lists and
I also tweaked a litt