Skip to content

Commit

Permalink
implement localSpanForKleisli in terms of MonadPartialOrder[F, Kleisl…
Browse files Browse the repository at this point in the history
…i[F, Span[F], *]]
  • Loading branch information
bpholt committed Jan 31, 2023
1 parent b32fbed commit dcf71de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions modules/mtl/shared/src/main/scala/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ package natchez

import cats._
import cats.data.Kleisli
import cats.mtl.Local
import cats.effect.{Trace => _, _}
import cats.mtl.{Local, MonadPartialOrder}

package object mtl {
implicit def natchezMtlTraceForLocal[F[_]](implicit
Expand All @@ -25,13 +25,13 @@ package object mtl {
)(f: Span[Kleisli[F, Span[F], *]] => Span[Kleisli[F, Span[F], *]]): Kleisli[F, Span[F], A] =
fa.local {
f.andThen(_.mapK(Kleisli.applyK(Span.noop[F])))
.compose(_.mapK(Kleisli.liftK))
.compose(_.mapK(MonadPartialOrder[F, Kleisli[F, Span[F], *]]))
}

override def applicative: Applicative[Kleisli[F, Span[F], *]] =
Kleisli.catsDataApplicativeForKleisli
MonadPartialOrder[F, Kleisli[F, Span[F], *]].monadG

override def ask[E2 >: Span[Kleisli[F, Span[F], *]]]: Kleisli[F, Span[F], E2] =
Kleisli.ask[F, Span[F]].map(_.mapK(Kleisli.liftK))
Kleisli.ask[F, Span[F]].map(_.mapK(MonadPartialOrder[F, Kleisli[F, Span[F], *]]))
}
}

0 comments on commit dcf71de

Please sign in to comment.