Skip to content

Replace localForIOLocal with IOLocal#toLocal[F] #1008

Open
@iRevive

Description

@iRevive

Once the typelevel/cats-effect#4438 is merged and released, we can do the clean up:

private[otel4s] def localForIOLocal[F[_]: MonadCancelThrow: LiftIO, Ctx](ioLocal: IOLocal[Ctx]): Local[F, Ctx] =
new Local[F, Ctx] {
def applicative: Applicative[F] =
Applicative[F]
def ask[E2 >: Ctx]: F[E2] =
MonadCancelThrow[F].widen[Ctx, E2](ioLocal.get.to[F])
def local[A](fa: F[A])(f: Ctx => Ctx): F[A] =
MonadCancelThrow[F].bracket(ioLocal.modify(e => (f(e), e)).to[F])(_ => fa)(ioLocal.set(_).to[F])
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions