Skip to content

Instantly share code, notes, and snippets.

@blouerat
Created March 24, 2015 14:37
Show Gist options
  • Save blouerat/83cc48e3e506b2616b18 to your computer and use it in GitHub Desktop.
Save blouerat/83cc48e3e506b2616b18 to your computer and use it in GitHub Desktop.
Retry
def retry[F[_]: Monad, E, A](f: => EitherT[F, E, A])(n: Int): EitherT[F, List[E], A] =
Stream.fill(n)(f).traverseU(_.swap).map(_.toList).swap
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment