Skip to content

Instantly share code, notes, and snippets.

@CremboC
Created January 2, 2018 14:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CremboC/264a1d3a93e6cd0d279504b8eec3883f to your computer and use it in GitHub Desktop.
Save CremboC/264a1d3a93e6cd0d279504b8eec3883f to your computer and use it in GitHub Desktop.
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