packages feed

timers-tick 0.4.1.0 → 0.4.2.0

raw patch · 4 files changed

+27/−2 lines, 4 filesdep ~hspecPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: hspec

API changes (from Hackage documentation)

+ Control.Timer.Tick: lapse :: Timed a -> Timed a

Files

changes.txt view
@@ -1,3 +1,9 @@+0.4.2.0+-------++- Added `lapse` function.+- Released Fri 22 Nov 2019 00:48:03 CET.+ 0.4.1.0 ------- 
src/Control/Timer/Tick.hs view
@@ -29,6 +29,7 @@                             tick,                             ticks,                             reset,+                            lapse,                             -- * Query                             isLive,                             isExpired,@@ -204,6 +205,11 @@ ticks 1 t = tick t ticks n t | n < 1     = error "negative number passed to `ticks`"           | otherwise = ticks (n-1) (tick t)++-- | Ticks the timer until 'isExpired' is @True@.+lapse :: Timed a -> Timed a+lapse t | isExpired t = t+        | otherwise   = lapse (tick t)  -- | Antonym of 'isExpired'. --
test/Control/Timer/TickSpec.hs view
@@ -72,3 +72,16 @@     it "resets the timer" $       reset (ticks 30 t) `shouldBe` t +  describe "lapse" $ do+    let t = creaBoolTimer 10+    it "lapses the timer" $+      lapse t `shouldBe` ticks 10 t++  describe "creaBoolTimerLoop" $ do+    let t  = creaBoolTimerLoop 10+    it "Expires after the right amount of clicks" $+      fetchFrame (ticks 10 t) `shouldBe` True+    let t' = creaTimedRes (Times 10 Reach) [(10, False), (1, True)]+    it "behaves similarly to a multi-loop timer" $+      fetchFrame (ticks 10 t) `shouldBe` fetchFrame (ticks 10 t')+
timers-tick.cabal view
@@ -1,5 +1,5 @@ name:                timers-tick-version:             0.4.1.0+version:             0.4.2.0 synopsis:            tick based timers description:         Tick-based timers and utilities, for games and                      discrete-time programs.@@ -36,7 +36,7 @@   HS-Source-Dirs:      test, src   main-is:             Tests.hs   build-depends:       base == 4.*-                       , hspec == 2.5.*+                       , hspec >= 2.5 && < 2.8   other-modules:       Control.Timer.Tick,                        Control.Timer.TickSpec   type:                exitcode-stdio-1.0