Open Atry opened 7 years ago
@Atry I don't quite understand, how do you use each
with cats
? Tried some imports but could not get them to work together.
For those interested, this solution worked for me:
implicit val monadR: scalaz.Monad[Resource[IO, *]] =
new Monad[Resource[IO, *]] {
override def point[A](a: => A): Resource[IO, A] = cats.effect.Resource
.pure(a)
override def bind[A, B](
fa: Resource[IO, A],
)(f: A => Resource[IO, B]): Resource[IO, B] = fa.flatMap(f)
}
import com.thoughtworks.each.Monadic._
monadic[Resource[IO, *]] {
// ...
IO
:
private implicit val monadR: scalaz.Monad[IO] = new scalaz.Monad[IO] {
override def bind[A, B](fa: IO[A])(f: A => IO[B]): IO[B] = fa.flatMap(f)
override def point[A](a: => A): IO[A] = IO.delay(a)
}
To be clear, each
does not support cats
. I just mean I created another similar library that supports cats
.
(reopen this issue so that people could find the solution in dsl-domains-cats easier)
Implemented in https://github.com/ThoughtWorksInc/dsl-domains-cats