Skip to content

Commit

Permalink
CHERRY MillisecondYield
Browse files Browse the repository at this point in the history
  • Loading branch information
turion committed Jul 21, 2023
1 parent d0802bb commit 3065748
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rhine/src/FRP/Rhine/Clock/Realtime/Millisecond.hs
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ newtype Millisecond (n :: Nat) = Millisecond (RescaledClockS IO (UnscheduleClock

-- TODO Consider changing the tag to Maybe Double

newtype MillisecondYield (n :: Nat) = MillisecondYield (RescaledClockS (YieldT IO) (FixedStep n) UTCTime Bool)

instance Clock IO (Millisecond n) where
type Time (Millisecond n) = UTCTime
type Tag (Millisecond n) = Bool
Expand Down Expand Up @@ -79,6 +81,7 @@ waitClock = Millisecond $ RescaledClockS (unyieldClock FixedStep) $ \_ -> do
return (now, remaining > 0)
return (runningClock, initTime)

-- FIXME this can actually only run reliably for MillisecondYield, otherwise GHC scheduling can come in the way
-- TODO It would be great if this could be directly implemented in terms of downsampleFixedStep
downsampleMillisecond ::
(KnownNat n, Monad m) =>
Expand Down

0 comments on commit 3065748

Please sign in to comment.