Skip to content

Commit

Permalink
Add an example of Trace instance for IO
Browse files Browse the repository at this point in the history
  • Loading branch information
mwz committed Dec 16, 2024
1 parent ba9221a commit 73d89ce
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion modules/docs/src/main/paradox/reference/trace.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,11 @@ This is more general than the `Kleisli` instance above and allows you to instant

Given a `Span[F]` you can construct a `Trace[IO]` for **Cats-Effect 3** (for Cats-Effect 2 you will need to use `Kleisli` or `Local` above). This uses `FiberLocal` to pass the span around.

TODO: Example
```scala mdoc
import cats.effect.IO

def goIO(span: Span[IO]): IO[Unit] =
Trace.ioTrace(span).flatMap { implicit trace =>
wibble[IO]("bob", 42)
}
```

0 comments on commit 73d89ce

Please sign in to comment.