You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reflex doesn't have a Pure Time module, Reflex.Time is impure #534
The Reflex.Time module uses the impure PerformEvent class. As a consequence, using Reflex.Time functions for e.g. animations would lead to glitches, e.g. if multiple identical animations start simultaneously.
We should:
Make the impure nature of the module clear in the documentation.
Consider renaming the module appropriately.
Implement a pure version of Time.
An efficient implementation of a pure Time would need a priority queue containing "scheduled time" values. In every frame, if the queue contains a value, check the current system time T; if scheduled time <= T, fire the triggers simultaneously.
Users might also want access to a time behavior. Implementing this behavior correctly and efficiently, together with the "scheduled time" queue is somewhat tricky, but must be possible.
A minimal class could look like this:
class (Reflex t) => HasTime t m | m -> t where
type Time t :: Type
type PositiveTimeDelta t :: Type
time :: Behavior t Time
after :: PositiveTimeDelta t -> m (Event ())
Activity