Using MonadPlus in FRP.Reactive.FieldTrip
- by ony
I'm studying FRP at this moment through FieldTrip adaptor. And hit the problem with strange way of frames scheduling and integration. So now I'm trying to build own marker Event for aligning Behaviour stepping.
So...
flipflop :: Behavior String
flipflop = stepper "none" (xflip 2) where
xflip t0 = do
t <- withTimeE_ (atTime t0)
return "flip" `mplus` xflop (t+3)
xflop t0 = do
t <- withTimeE_ (atTime t0)
return "flop" `mplus` xflip (t+2)
txtGeom = ((uscale2 (0.5::Float) *%) . utext . show <$>)
main = anim2 (txtGeom . pure flipflop)
Questions is:
Why this example leads to memory leak?
Is there safe way to build sequence of events where each next one is scheduled depending on previous?