Last active
July 24, 2016 12:35
-
-
Save fiadliel/2bdacbf4dea25d9a1fc41cbd4c00430c 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.imports._ | |
import doobie.util.compat.cats.monad._ // todo: make this automatic | |
import cats._, cats.data._, cats.implicits._ | |
import doobie.util.capture.{Capture => DCapture} | |
import doobie.util.catchable.{Catchable => DCatchable} | |
object Implicits { | |
implicit def doobieCatchable[F[_]](implicit F: ApplicativeError[F, Throwable]): DCatchable[F] = new DCatchable[F] { | |
def attempt[A](ma: F[A]): F[cats.data.Xor[Throwable, A]] = F.attempt(ma) | |
def fail[A](t: Throwable): F[A] = F.raiseError(t) | |
} | |
implicit def doobieCapture[F[_]](implicit F: Applicative[F]): DCapture[F] = new DCapture[F] { | |
def apply[A](a: => A): F[A] = F.pureEval(Eval.always(a)) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment