Skip to content

Commit

Permalink
Fix Capture instances for IO and Future (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
pepegar authored and BenFradet committed Feb 14, 2018
1 parent 3f63903 commit b836bc5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Expand Up @@ -82,7 +82,7 @@ class CatsEffectJSSpec extends AsyncFunSuite with Matchers {
}

// only here for the 80% coverage, to remove once JS makes use of Captures
test("IOCapture == IO.pure") {
ioCaptureInstance.capture("a") shouldBe IO.pure("a")
test("IOCapture == IO.apply") {
ioCaptureInstance.capture("a") shouldBe IO("a")
}
}
Expand Up @@ -21,6 +21,6 @@ import github4s.free.interpreters.Capture

trait IOCaptureInstance {
implicit val ioCaptureInstance = new Capture[IO] {
override def capture[A](a: A): IO[A] = IO.pure(a)
override def capture[A](a: A): IO[A] = IO(a)
}
}
6 changes: 3 additions & 3 deletions github4s/shared/src/main/scala/github4s/Implicits.scala
Expand Up @@ -19,7 +19,7 @@ package github4s
import cats.instances.FutureInstances
import cats.{Eval, FlatMap, Id, Monad, MonadError}
import github4s.free.interpreters._
import scala.concurrent.Future
import scala.concurrent.{Future, ExecutionContext}

object implicits
extends FutureCaptureInstance
Expand All @@ -29,8 +29,8 @@ object implicits

trait FutureCaptureInstance {
//Future Capture evidence:
implicit val futureCaptureInstance = new Capture[Future] {
override def capture[A](a: A): Future[A] = Future.successful(a)
implicit def futureCaptureInstance(implicit ec: ExecutionContext) = new Capture[Future] {
override def capture[A](a: A): Future[A] = Future(a)
}
}

Expand Down

0 comments on commit b836bc5

Please sign in to comment.