All Downloads are FREE. Search and download functionalities are using the official Maven repository.

sttp.client3.impl.cats.CatsMonadAsyncError.scala Maven / Gradle / Ivy

There is a newer version: 3.10.0
Show newest version
package sttp.client3.impl.cats

import cats.effect.kernel.Async
import cats.syntax.functor._
import cats.syntax.option._
import sttp.monad.{Canceler, MonadAsyncError}

class CatsMonadAsyncError[F[_]](implicit F: Async[F]) extends CatsMonadError[F] with MonadAsyncError[F] {
  override def async[T](register: ((Either[Throwable, T]) => Unit) => Canceler): F[T] =
    F.async(cb => F.delay(register(cb)).map(c => F.delay(c.cancel()).some))
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy