fixed-timestep 0.2.0.0 → 0.2.0.1
raw patch · 3 files changed
+14/−6 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- fixed-timestep.cabal +1/−1
- lib/Time/Repeatedly.hs +8/−5
CHANGELOG.md view
@@ -1,5 +1,10 @@ # Revision history for fixed-timestep +## 0.2.0.1 -- 2019-03-25 + +* Improve docs + * Clarify that frequencies are given in units of Hertz. + ## 0.2.0.0 -- 2019-03-25 * Rename `Time.Flick.secnd` to `Time.Flick.oneSecond`
fixed-timestep.cabal view
@@ -4,7 +4,7 @@ -- http://haskell.org/cabal/users-guide/ name: fixed-timestep -version: 0.2.0.0 +version: 0.2.0.1 synopsis: Pure Haskell library to repeat an action at a specific frequency. description: Repeat IO actions at a specific frequency, using flicks (1/705600000 of a second) for timekeeping.
lib/Time/Repeatedly.hs view
@@ -1,5 +1,8 @@ -- | Utilities for repeatedly running @'IO'@ actions -- at a specific frequency. +-- +-- Frequencies are in Hertz; for example, @'repeatedly' 20 act@ +-- will run @act@ 20 times per second. module Time.Repeatedly ( -- * Repeating actions repeatedly @@ -36,31 +39,31 @@ , tscClockType :: Clock } deriving Eq --- | Run an action repeatedly at the specified frequency. +-- | Run an action repeatedly at the specified frequency (in Hertz). -- Uses the 'Monotonic' clock for timing. repeatedly :: Rational -> IO a -> IO void repeatedly freq = repeatedly' freq Monotonic --- | Run an action repeatedly at the specified frequency, +-- | Run an action repeatedly at the specified frequency (in Hertz), -- using the given clock type. repeatedly' :: Rational -> Clock -> IO a -> IO void repeatedly' freq clockTy act = do clock <- newClock freq clockTy loopUsing clock act --- | Run an action repeatedly at the specified frequency, in a separate thread. +-- | Run an action repeatedly at the specified frequency (in Hertz), in a separate thread. -- Uses the 'Monotonic' clock for timing. asyncRepeatedly :: Rational -> IO a -> IO (Async void) asyncRepeatedly freq = asyncRepeatedly' freq Monotonic --- | Run an action repeatedly at the specified frequency, in a separate thread, +-- | Run an action repeatedly at the specified frequency (in Hertz), in a separate thread, -- using the given clock type. asyncRepeatedly' :: Rational -> Clock -> IO a -> IO (Async void) asyncRepeatedly' freq clockTy act = do clock <- newClock freq clockTy async (loopUsing clock act) --- | Initialise a new clock structure for the given frequency and using +-- | Initialise a new clock structure for the given frequency (in Hertz) and using -- the given clock type. newClock :: Rational -> Clock -> IO TimeStepClock newClock freq clockTy = do