Skip to content

Commit

Permalink
Make Future a CommutativeMonad
Browse files Browse the repository at this point in the history
  • Loading branch information
Luka Jacobowitz committed Sep 28, 2017
1 parent 0ea4ac0 commit edd6ba8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/src/main/scala/cats/instances/future.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import scala.concurrent.{ExecutionContext, Future}

trait FutureInstances extends FutureInstances1 {

implicit def catsStdInstancesForFuture(implicit ec: ExecutionContext): MonadError[Future, Throwable] with CoflatMap[Future] with Monad[Future] =
new FutureCoflatMap with MonadError[Future, Throwable] with Monad[Future] with StackSafeMonad[Future] {
implicit def catsStdInstancesForFuture(implicit ec: ExecutionContext): MonadError[Future, Throwable] with CoflatMap[Future] with CommutativeMonad[Future] =
new FutureCoflatMap with MonadError[Future, Throwable] with CommutativeMonad[Future] with StackSafeMonad[Future] {
def pure[A](x: A): Future[A] = Future.successful(x)

def flatMap[A, B](fa: Future[A])(f: A => Future[B]): Future[B] = fa.flatMap(f)
Expand Down
2 changes: 1 addition & 1 deletion js/src/test/scala/cats/tests/FutureTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class FutureTests extends CatsSuite {

checkAll("Future[Int]", MonadErrorTests[Future, Throwable].monadError[Int, Int, Int])
checkAll("Future[Int]", ComonadTests[Future].comonad[Int, Int, Int])
checkAll("Future", MonadTests[Future].monad[Int, Int, Int])
checkAll("Future", CommutativeMonadTests[Future].commutativeMonad[Int, Int, Int])

{
implicit val F = ListWrapper.semigroup[Int]
Expand Down
2 changes: 1 addition & 1 deletion jvm/src/test/scala/cats/tests/FutureTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FutureTests extends CatsSuite {
Arbitrary(arbitrary[Exception].map(identity))

checkAll("Future with Throwable", MonadErrorTests[Future, Throwable].monadError[Int, Int, Int])
checkAll("Future", MonadTests[Future].monad[Int, Int, Int])
checkAll("Future", CommutativeMonadTests[Future].commutativeMonad[Int, Int, Int])
checkAll("Future", CoflatMapTests[Future].coflatMap[Int, Int, Int])

{
Expand Down

0 comments on commit edd6ba8

Please sign in to comment.