Skip to content

Instantly share code, notes, and snippets.

@CremboC

CremboC/cats.scala Secret

Created Jan 2, 2018
Embed
What would you like to do?
import cats._
import cats.implicits._
import cats.effect.IO
implicit def ioMonoid[A: cats.Monoid]: cats.Monoid[IO[A]] = new Monoid[IO[A]] {
override def empty: IO[A] = IO(Monoid[A].empty)
override def combine(x: IO[A], y: IO[A]): IO[A] = x.flatMap(_ => y)
}
Monoid[IO[Option[Int]].empty
// could not find implicit value for parameter ev: cats.kernel.Monoid[cats.effect.IO[Option[Int]]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment