Created
March 17, 2019 16:06
-
-
Save ahoy-jon/5961673e9e09bce195916fb334996a55 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/shared/src/main/scala/scalaz/zio/clock/package.scala b/core/shared/src/main/scala/scalaz/zio/clock/package.scala | |
index 5691082e..33cfcb61 100644 | |
--- a/core/shared/src/main/scala/scalaz/zio/clock/package.scala | |
+++ b/core/shared/src/main/scala/scalaz/zio/clock/package.scala | |
@@ -17,28 +17,37 @@ | |
package scalaz.zio | |
import scalaz.zio.duration.Duration | |
- | |
import java.util.concurrent.TimeUnit | |
-package object clock extends Clock.Service[Clock] { | |
- final val clockService: ZIO[Clock, Nothing, Clock.Service[Any]] = | |
- ZIO.access(_.clock) | |
- | |
- /** | |
- * Returns the current time, relative to the Unix epoch. | |
- */ | |
- final def currentTime(unit: TimeUnit): ZIO[Clock, Nothing, Long] = | |
- ZIO.accessM(_.clock currentTime unit) | |
- | |
- /** | |
- * Returns the system nano time, which is not relative to any date. | |
- */ | |
- final val nanoTime: ZIO[Clock, Nothing, Long] = | |
- ZIO.accessM(_.clock.nanoTime) | |
- | |
- /** | |
- * Sleeps for the specified duration. This is always asynchronous. | |
- */ | |
- final def sleep(duration: Duration): ZIO[Clock, Nothing, Unit] = | |
- ZIO.accessM(_.clock sleep duration) | |
+package object clock { | |
+ final val clockService:ZIO[Clock, Nothing, Clock.Service[Any]] = clockPackage.clockService | |
+ final def currentTime(unit: TimeUnit): ZIO[Clock, Nothing, Long] = clockPackage.currentTime(unit) | |
+ final val nanoTime: ZIO[Clock, Nothing, Long] = clockPackage.nanoTime | |
+ final def sleep(duration: Duration): ZIO[Clock, Nothing, Unit] = clockPackage.sleep(duration) | |
+ | |
+ | |
+ private object clockPackage extends Clock.Service[Clock] { | |
+ final val clockService: ZIO[Clock, Nothing, Clock.Service[Any]] = | |
+ ZIO.access(_.clock) | |
+ | |
+ /** | |
+ * Returns the current time, relative to the Unix epoch. | |
+ */ | |
+ final def currentTime(unit: TimeUnit): ZIO[Clock, Nothing, Long] = | |
+ ZIO.accessM(_.clock currentTime unit) | |
+ | |
+ /** | |
+ * Returns the system nano time, which is not relative to any date. | |
+ */ | |
+ final val nanoTime: ZIO[Clock, Nothing, Long] = | |
+ ZIO.accessM(_.clock.nanoTime) | |
+ | |
+ /** | |
+ * Sleeps for the specified duration. This is always asynchronous. | |
+ */ | |
+ final def sleep(duration: Duration): ZIO[Clock, Nothing, Unit] = | |
+ ZIO.accessM(_.clock sleep duration) | |
+ } | |
+ | |
} | |
+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment