Skip to content

Instantly share code, notes, and snippets.

@ahoy-jon
Created March 17, 2019 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahoy-jon/5961673e9e09bce195916fb334996a55 to your computer and use it in GitHub Desktop.
Save ahoy-jon/5961673e9e09bce195916fb334996a55 to your computer and use it in GitHub Desktop.
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