File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
smetrics/src/main/scala/com/evolutiongaming/smetrics Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ lazy val smetrics = (project
4444 libraryDependencies ++= Seq (
4545 Cats .core,
4646 Cats .effect,
47+ `cats-helper` % Optional ,
4748 `cats-helper` % Test ,
4849 scalatest % Test ),
4950 libraryDependencies ++= crossSettings(
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package com.evolutiongaming.smetrics
33import cats .effect .Clock
44import cats .implicits ._
55import cats .{Applicative , FlatMap , ~> }
6+ import com .evolutiongaming .catshelper
67
78import scala .concurrent .duration ._
89
@@ -29,6 +30,11 @@ object MeasureDuration {
2930 fromClock1(clock, FlatMap [F ])
3031 }
3132
33+ def fromCatsHelper [F [_]](implicit csMeasureDuration : catshelper.MeasureDuration [F ]): MeasureDuration [F ] =
34+ new MeasureDuration [F ] {
35+ override def start : F [F [FiniteDuration ]] = csMeasureDuration.start
36+ }
37+
3238 implicit def fromClock1 [F [_]: Clock : FlatMap ]: MeasureDuration [F ] = {
3339 val duration = for {
3440 duration <- Clock [F ].monotonic
@@ -58,6 +64,10 @@ object MeasureDuration {
5864
5965 val start : G [G [FiniteDuration ]] = f(self.start.map(f.apply))
6066 }
67+
68+ def toCatsHelper : catshelper.MeasureDuration [F ] = new catshelper.MeasureDuration [F ] {
69+ override def start : F [F [FiniteDuration ]] = self.start
70+ }
6171 }
6272
63- }
73+ }
You can’t perform that action at this time.
0 commit comments