I have this timeHandler function that is executed each frame and for which the time passed since the application started is passed as a floating argument:
timeHandler :: Float -> World -> World
timeHandler time = ... my funcs ...
Now I have one function that doesn't need to be executed EACH frame but, for example, each 10 frames. So I figured I'd use the mod function for this but that's not working:
timeHandler time = if (((floor time) `mod` 10) == 0) then myFunc else id
I figured I'd execute the function only when the time divided by 10 leaves no rest value, or in other words: execute it each 10 seconds (at least that's what I thought). But (obviously) it's not working, it seems the condition is always true.
If someone could help me out on this it'd be much appreciated!
Best regards, Skyfe.
myFunc
every 10 seconds for 1 second. If you need to be assured of this -map (\time -> ((floor time)
mod` 10) == 0) [9.95, 10.00 .. 11.05]`. Your error is almost certainly elsewhere.