Skip to content

Commit

Permalink
Change Context.apply => Context.evaluateUsing
Browse files Browse the repository at this point in the history
  • Loading branch information
natsukagami committed Nov 29, 2023
1 parent b0d68aa commit 6f99ee5
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ abstract class AbstractCurlBackend[F[_]](_monad: MonadError[F], verbose: Boolean
}

private object Context {
def apply[T](body: Context => F[T]): F[T] = {

/** Create a new context and evaluates the body with it. Closes the context at the end. */
def evaluateUsing[T](body: Context => F[T]): F[T] = {
implicit val ctx = new Context()
body(ctx).ensure(monad.unit(ctx.close()))
}
Expand Down Expand Up @@ -97,7 +99,7 @@ abstract class AbstractCurlBackend[F[_]](_monad: MonadError[F], verbose: Boolean
}
}

Context(ctx => perform(ctx))
Context.evaluateUsing(ctx => perform(ctx))
}

private def adjustExceptions[T](request: GenericRequest[_, _])(t: => F[T]): F[T] =
Expand Down

0 comments on commit 6f99ee5

Please sign in to comment.