Skip to content

Instantly share code, notes, and snippets.

@kubukoz
Created May 20, 2022 20:17
Show Gist options
  • Select an option

  • Save kubukoz/e5f80263e74be317e21c9bd6142dbffd to your computer and use it in GitHub Desktop.

Select an option

Save kubukoz/e5f80263e74be317e21c9bd6142dbffd to your computer and use it in GitHub Desktop.
//>using scala "3.1.1"
//>using lib "org.typelevel::cats-core:2.7.0"
//>using lib "org.typelevel::cats-effect:3.3.9"
sealed trait Error extends Product with Serializable
object Error {
case object C extends Error
}
object demo {
import util.chaining._
import cats.implicits._
import cats.effect._
import cats.data._
val r =
for {
a <- IO(42).pipe(EitherT.liftF(_))
b <- 42.asRight.toEitherT[IO]
c <- Error.C.asLeft.toEitherT[IO]
} yield ()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment