Skip to content

Instantly share code, notes, and snippets.

@Yotamho
Created December 17, 2020 09:05
Show Gist options
  • Select an option

  • Save Yotamho/37c54177abab011d13e8f38f39a619aa to your computer and use it in GitHub Desktop.

Select an option

Save Yotamho/37c54177abab011d13e8f38f39a619aa to your computer and use it in GitHub Desktop.
object ParallelNested {
// Taking inspiration from `cats.IO`'s `Parallel` instance:
// https://github.com/typelevel/cats-effect/blob/a6ebc9fd7f02dc15a74c0e9a1cfca3c843b63efb/core/shared/src/main/scala/cats/effect/IO.scala#L970-L988
implicit val nestedParallel = new NonEmptyParallel[Nested[IO, ValidatedNec[Throwable, *], *]] {
override type F = Nested[IO.Par, ValidatedNec[Throwable, *], *]
override def apply: Apply[F] = Apply[F]
override def flatMap: FlatMap[Nested[IO, ValidatedNec[Throwable, *], *]] = FlatMap[Nested[IO, ValidatedNec[Throwable, *], *]]
override def sequential: ~>[F, Nested[IO, ValidatedNec[Throwable, *], *]] = ???
override def parallel: ~>[Nested[IO, ValidatedNec[Throwable, *], *], F] = ???
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment