Skip to content

Commit

Permalink
Further inlining
Browse files Browse the repository at this point in the history
  • Loading branch information
turion committed Aug 8, 2024
1 parent 2f72d1a commit 28c4854
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions rhine/src/FRP/Rhine/Clock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ instance
( runningClock >>> first (arr f)
, f initTime
)
{-# INLINE initClock #-}

{- | Instead of a mere function as morphism of time domains,
we can transform one time domain into the other with an effectful morphism.
Expand Down Expand Up @@ -205,6 +206,7 @@ instance
( runningClock >>> rescaling
, rescaledInitTime
)
{-# INLINE initClock #-}

-- | A 'RescaledClockM' is trivially a 'RescaledClockS'.
rescaledClockMToS ::
Expand Down Expand Up @@ -242,6 +244,7 @@ instance
( hoistS monadMorphism runningClock
, initialTime
)
{-# INLINE initClock #-}

-- | Lift a clock type into a monad transformer.
type LiftClock m t cl = HoistClock m (t m) cl
Expand Down
1 change: 1 addition & 0 deletions rhine/src/FRP/Rhine/Clock/Realtime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,4 @@ waitUTC unscaledClockS =
return (now, (tag, guard (remaining > 0) >> return (fromRational remaining)))
return (runningClock, initTime)
}
{-# INLINE waitUTC #-}
2 changes: 2 additions & 0 deletions rhine/src/FRP/Rhine/Clock/Realtime/Millisecond.hs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ instance Clock IO (Millisecond n) where
type Time (Millisecond n) = UTCTime
type Tag (Millisecond n) = Maybe Double
initClock (Millisecond cl) = initClock cl <&> first (>>> arr (second snd))
{-# INLINE initClock #-}

instance GetClockProxy (Millisecond n)

-- | Tries to achieve real time by using 'waitUTC', see its docs.
waitClock :: (KnownNat n) => Millisecond n
waitClock = Millisecond $ waitUTC $ RescaledClock (unyieldClock FixedStep) ((/ 1000) . fromInteger)
{-# INLINE waitClock #-}
1 change: 1 addition & 0 deletions rhine/src/FRP/Rhine/Clock/Unschedule.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ instance (TimeDomain (Time cl), Clock (ScheduleT (Diff (Time cl)) m) cl, Monad m
where
run :: ScheduleT (Diff (Time cl)) m a -> m a
run = runScheduleT scheduleWait
{-# INLINE initClock #-}
1 change: 1 addition & 0 deletions rhine/src/FRP/Rhine/Clock/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,4 @@ genTimeInfo _ initialTime = proc (absolute, tag) -> do
, sinceInit = absolute `diffTime` initialTime
, ..
}
{-# INLINE genTimeInfo #-}

0 comments on commit 28c4854

Please sign in to comment.