packages feed

polysemy-time 0.1.3.1 → 0.1.3.2

raw patch · 4 files changed

+25/−24 lines, 4 filesdep −polysemy-pluginPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependencies removed: polysemy-plugin

API changes (from Hackage documentation)

- Polysemy.Time: adjust :: forall t_axdA d_axdD r_axiA u1_XxdC u2_XxdE. (MemberWithError (Time t_axdA d_axdD) r_axiA, AddTimeUnit t_axdA u1_XxdC u2_XxdE) => u1_XxdC -> Sem r_axiA ()
+ Polysemy.Time: adjust :: forall t_axfK d_axfN r_axkK u1_XxfM u2_XxfO. (MemberWithError (Time t_axfK d_axfN) r_axkK, AddTimeUnit t_axfK u1_XxfM u2_XxfO) => u1_XxfM -> Sem r_axkK ()
- Polysemy.Time: now :: forall t_axdn d_axdo r_axiu. MemberWithError (Time t_axdn d_axdo) r_axiu => Sem r_axiu t_axdn
+ Polysemy.Time: now :: forall t_axfx d_axfy r_axkE. MemberWithError (Time t_axfx d_axfy) r_axkE => Sem r_axkE t_axfx
- Polysemy.Time: setDate :: forall t_axdG d_axdF r_axiC. MemberWithError (Time t_axdG d_axdF) r_axiC => d_axdF -> Sem r_axiC ()
+ Polysemy.Time: setDate :: forall t_axfQ d_axfP r_axkM. MemberWithError (Time t_axfQ d_axfP) r_axkM => d_axfP -> Sem r_axkM ()
- Polysemy.Time: setTime :: forall t_axdx d_axdy r_axiy. MemberWithError (Time t_axdx d_axdy) r_axiy => t_axdx -> Sem r_axiy ()
+ Polysemy.Time: setTime :: forall t_axfH d_axfI r_axkI. MemberWithError (Time t_axfH d_axfI) r_axkI => t_axfH -> Sem r_axkI ()
- Polysemy.Time: sleep :: forall t_axdu d_axdv r_axiw u_Xxdu. (MemberWithError (Time t_axdu d_axdv) r_axiw, TimeUnit u_Xxdu) => u_Xxdu -> Sem r_axiw ()
+ Polysemy.Time: sleep :: forall t_axfE d_axfF r_axkG u_XxfE. (MemberWithError (Time t_axfE d_axfF) r_axkG, TimeUnit u_XxfE) => u_XxfE -> Sem r_axkG ()
- Polysemy.Time: today :: forall t_axdq d_axdr r_axiv. MemberWithError (Time t_axdq d_axdr) r_axiv => Sem r_axiv d_axdr
+ Polysemy.Time: today :: forall t_axfA d_axfB r_axkF. MemberWithError (Time t_axfA d_axfB) r_axkF => Sem r_axkF d_axfB
- Polysemy.Time.Data.Time: adjust :: forall t_axdA d_axdD r_axiA u1_XxdC u2_XxdE. (MemberWithError (Time t_axdA d_axdD) r_axiA, AddTimeUnit t_axdA u1_XxdC u2_XxdE) => u1_XxdC -> Sem r_axiA ()
+ Polysemy.Time.Data.Time: adjust :: forall t_axfK d_axfN r_axkK u1_XxfM u2_XxfO. (MemberWithError (Time t_axfK d_axfN) r_axkK, AddTimeUnit t_axfK u1_XxfM u2_XxfO) => u1_XxfM -> Sem r_axkK ()
- Polysemy.Time.Data.Time: now :: forall t_axdn d_axdo r_axiu. MemberWithError (Time t_axdn d_axdo) r_axiu => Sem r_axiu t_axdn
+ Polysemy.Time.Data.Time: now :: forall t_axfx d_axfy r_axkE. MemberWithError (Time t_axfx d_axfy) r_axkE => Sem r_axkE t_axfx
- Polysemy.Time.Data.Time: setDate :: forall t_axdG d_axdF r_axiC. MemberWithError (Time t_axdG d_axdF) r_axiC => d_axdF -> Sem r_axiC ()
+ Polysemy.Time.Data.Time: setDate :: forall t_axfQ d_axfP r_axkM. MemberWithError (Time t_axfQ d_axfP) r_axkM => d_axfP -> Sem r_axkM ()
- Polysemy.Time.Data.Time: setTime :: forall t_axdx d_axdy r_axiy. MemberWithError (Time t_axdx d_axdy) r_axiy => t_axdx -> Sem r_axiy ()
+ Polysemy.Time.Data.Time: setTime :: forall t_axfH d_axfI r_axkI. MemberWithError (Time t_axfH d_axfI) r_axkI => t_axfH -> Sem r_axkI ()
- Polysemy.Time.Data.Time: sleep :: forall t_axdu d_axdv r_axiw u_Xxdu. (MemberWithError (Time t_axdu d_axdv) r_axiw, TimeUnit u_Xxdu) => u_Xxdu -> Sem r_axiw ()
+ Polysemy.Time.Data.Time: sleep :: forall t_axfE d_axfF r_axkG u_XxfE. (MemberWithError (Time t_axfE d_axfF) r_axkG, TimeUnit u_XxfE) => u_XxfE -> Sem r_axkG ()
- Polysemy.Time.Data.Time: today :: forall t_axdq d_axdr r_axiv. MemberWithError (Time t_axdq d_axdr) r_axiv => Sem r_axiv d_axdr
+ Polysemy.Time.Data.Time: today :: forall t_axfA d_axfB r_axkF. MemberWithError (Time t_axfA d_axfB) r_axkF => Sem r_axkF d_axfB

Files

polysemy-time.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           polysemy-time-version:        0.1.3.1+version:        0.1.3.2 synopsis:       Polysemy Effect for Time description:    Please see the readme on Github at <https://github.com/tek/polysemy-time> category:       Time@@ -186,7 +186,7 @@       UndecidableInstances       UnicodeSyntax       ViewPatterns-  ghc-options: -flate-specialise -fspecialise-aggressively -Wall -threaded -rtsopts -with-rtsopts=-N -fplugin=Polysemy.Plugin+  ghc-options: -flate-specialise -fspecialise-aggressively -Wall -threaded -rtsopts -with-rtsopts=-N   build-depends:       aeson >=1.4     , base ==4.*@@ -196,7 +196,6 @@     , either     , hedgehog     , polysemy >=1.3-    , polysemy-plugin     , polysemy-test     , polysemy-time     , relude >=0.7
test/Polysemy/Time/Test/GhcTimeTest.hs view
@@ -1,7 +1,7 @@ module Polysemy.Time.Test.GhcTimeTest where  import Data.Time (Day, UTCTime)-import Polysemy.Test (UnitTest, assert, runTestAuto, (===))+import Polysemy.Test (UnitTest, assert, assertEq, runTestAuto) import Polysemy.Test.Data.Hedgehog (Hedgehog)  import Polysemy.Time.Calendar (mkDatetime, year)@@ -11,18 +11,19 @@ import Polysemy.Time.Ghc (interpretTimeGhc, interpretTimeGhcAt)  prog ::+  ∀ t d r .   Ord t =>   Members [Time t d, Hedgehog IO] r =>   Sem r () prog = do-  time1 <- Time.now-  time2 <- Time.now-  assert (time1 < time2)+  time1 <- Time.now @t @d+  time2 <- Time.now @t @d+  assert @IO (time1 < time2)  test_ghcTime :: UnitTest test_ghcTime =   runTestAuto do-    interpretTimeGhc prog+    interpretTimeGhc (prog @UTCTime @Day)  testTime :: UTCTime testTime =@@ -33,8 +34,8 @@   runTestAuto do     interpretTimeGhcAt testTime do       Time.sleep @UTCTime @Day (Seconds 1)-      time <- Time.now-      1846 === year time-      Time.adjust (Days 366)-      time1 <- Time.now-      1847 === year time1+      time <- Time.now @UTCTime @Day+      assertEq @_ @IO 1846 (year time)+      Time.adjust @UTCTime @Day (Days 366)+      time1 <- Time.now @UTCTime @Day+      assertEq @_ @IO 1847 (year time1)
test/Polysemy/Time/Test/MeasureTest.hs view
@@ -1,5 +1,6 @@ module Polysemy.Time.Test.MeasureTest where +import Data.Time (Day, UTCTime) import Polysemy.Test (UnitTest, assert, runTestAuto)  import qualified Polysemy.Time.Data.Time as Time@@ -11,11 +12,11 @@ test_measure =   runTestAuto do     interpretTimeGhc do-      (t1, t2) <- measure do-        Time.sleep (MilliSeconds 100)-        fst <$> measure (Time.sleep (MilliSeconds 100))-      assert (t2 > convert (MilliSeconds 100))-      assert (t1 > convert (MilliSeconds 200))-      assert (t2 < t1)-      assert (t2 < convert (MilliSeconds 200))+      (t1, t2) <- measure @_ @UTCTime @Day do+        Time.sleep @UTCTime @Day (MilliSeconds 100)+        fst <$> measure @_ @UTCTime @Day (Time.sleep @UTCTime @Day (MilliSeconds 100))+      assert @IO (t2 > convert (MilliSeconds 100))+      assert @IO (t1 > convert (MilliSeconds 200))+      assert @IO (t2 < t1)+      assert @IO (t2 < convert (MilliSeconds 200)) 
test/Polysemy/Time/Test/TimeUnitTest.hs view
@@ -1,12 +1,12 @@ module Polysemy.Time.Test.TimeUnitTest where -import Polysemy.Test (UnitTest, runTestAuto, (===))+import Polysemy.Test (UnitTest, assertEq, runTestAuto)  import Polysemy.Time.Data.TimeUnit (MicroSeconds (MicroSeconds), MilliSeconds (MilliSeconds))  test_fractional :: UnitTest test_fractional =   runTestAuto do-    MilliSeconds 50 === 0.05-    MicroSeconds 200 === 0.0002-    MilliSeconds 50 === (MilliSeconds 100 / MilliSeconds 2)+    assertEq @_ @IO (MilliSeconds 50) 0.05+    assertEq @_ @IO (MicroSeconds 200) 0.0002+    assertEq @_ @IO (MilliSeconds 50) (MilliSeconds 100 / MilliSeconds 2)