Skip to content

Instantly share code, notes, and snippets.

@afsalthaj
Created March 28, 2019 23:09
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 afsalthaj/a9567f27347653c18a17f0be2fe7176e to your computer and use it in GitHub Desktop.
Save afsalthaj/a9567f27347653c18a17f0be2fe7176e to your computer and use it in GitHub Desktop.
object Repeat {
def apply(f: Task[Unit], duration: Duration): Task[List[Any]] =
Nondeterminism[Task].gatherUnordered(List(Task.fork(f), Task.fork { apply(f, duration).after(duration) }))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment