Erik:
> You have discovered the essence of monads, ie the difference between the bad
> and ugly world of side-effecting computations and the nice and clean world
> of pure functions. And even using my favourite example (*)!
Let's put it in other words: I knew the difference,
I was just not careful enough. What I often do when
in a midst of debugging is to move a local definition
temporarily to the left margin, just for debugging.
This time I got badly bitten.
I thought that this was such a spectacular example
that I decided to share it with the world :-).
>
> You say the currentSecond has type Int, so it is a pure value. However, when
> you assume that, you can prove that True equals False. It is not without
> reason that unsafePerformIO is called *unsafe*PerformIO!
Well, I said the same in my post.
>
> You said, "To my distress the clock stopped after the first call to
> `currentSecond'". Well, it is not the clock that stopped, but Haskell that
> assumes that it only has to look at the clock once to compute currentSecond,
> and thereafter immediately return that value everytime currentSecond is
> needed.
"To my distress the clock stopped .." supposed to be a joke.
Friendly,
Jan