Created
November 2, 2018 17:24
-
-
Save cakper/03f6b921f9dad09e4365490c2e234407 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
implicit class TaskExtenstions[A](val task: Task[A]) extends AnyVal { | |
def timed(): Task[A] = { | |
for { | |
startTime <- Task.eval(nanoTime()) | |
result <- task.doOnFinish { | |
case _ => logger.info(nanoTime() - startTime) | |
} | |
} yield result | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment