
2008/8/13 Benjamin L. Russell
P.S. Yes, I have read Paul's book and I think Haskell has something to it. You may be surprised to learn, however, that world.ss animations are purely functional while Haskell animations (in Paul's book) are actually quasi-imperative. That is, they are using monads and carry the imperativeness on their sleeves.
In response to this claim, does anybody know how to rewrite Hudak's SOE animations so that they do not use monads and are "purely functional?"
First, monad /= imperative It is important to establish this distinction which doesn't seem to be very clear in some minds... The IO monad allows imperative actions, the ST monad too, the Maybe Monad doesn't, neither does the List Monad... The State monad can be argued either way but all it does is make easier to use a pattern you often meet in non-monadic functional programming. The confusion is helped along by the do-notation in Haskell which definitely looks like imperative programming, but is only sugar over a purely functional form. Now, I don't know SOE very well and it is very possible that its description of animation is imperative but animations imply to handle time and order of operations anyway, so I don't really see how you could implement that in a more purely functional style, a monad is very good at describing ordered actions with a light syntax in a functional context. (Another aspect is if the details of the rendering of the animation is interleaved with the description, that is a more interesting subject, on which we could compare the code in world.ss and SOE) -- Jedaï