Created
March 24, 2015 14:37
-
-
Save blouerat/83cc48e3e506b2616b18 to your computer and use it in GitHub Desktop.
Retry
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
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