I am learning Haskell and Yampa at the moment and have a question about the reactimate function.
reactimate :: IO a -- init
-> (Bool -> IO (DTime, Maybe a)) -- sense
-> (Bool -> b -> IO Bool) -- actuate
-> SF a b -- signal function
-> IO ()
As you can see in the type signature, part of the output for the sense function is the time difference between the current and previous call of the function. In the examples I have seen, this time difference is "manually" calculated inside of sense, using an IORef to keep the value of the previous call.
It seems weird that you have to keep track of the time difference using an external state, why isn't this calculation done in the reactimate function? Is an IORef a good way to handle it?