Created
July 24, 2016 11:33
-
-
Save fiadliel/3766298682aaf424f4df71b0c9bc6048 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
import doobie.util.catchable.{Catchable => DCatchable} | |
import doobie.util.capture.{Capture => DCapture} | |
import fs2.Task | |
import fs2.util.Effect | |
object Implicits { | |
implicit def doobieCatchable[F[_]](implicit F: Effect[F]): DCatchable[F] = new DCatchable[F] { | |
def attempt[A](ma: F[A]): F[cats.data.Xor[Throwable, A]] = | |
F.attempt(ma).map(_.fold(Xor.left, Xor.right)) | |
def fail[A](t: Throwable): F[A] = F.fail(t) | |
} | |
implicit def doobieCapture[F[_]](implicit F: Effect[F]): DCapture[F] = new DCapture[F] { | |
def apply[A](a: => A): F[A] = F.delay(a) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment