Skip to content

Commit

Permalink
Fix mdoc compilation error
Browse files Browse the repository at this point in the history
  • Loading branch information
BalmungSan committed Sep 26, 2023
1 parent 53016c8 commit 33c93b1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions docs/std/mapref.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ title: MapRef
A total map from a key to a `Ref` of its value.

```scala mdoc:silent
import cats.effect.Ref

trait MapRef[F[_], K, V] {

/**
Expand Down Expand Up @@ -35,20 +37,17 @@ This is probably one of the most common uses of this datatype.
import cats.effect.IO
import cats.effect.std.MapRef

type Id
type Data

trait DatabaseClient[F[_]] {
trait DatabaseClient[F[_], Id, Data] {
def getDataById(id: Id): F[Option[Data]]
def upsertData(id: Id, data: Data): F[Unit]
}

object DatabaseClient {
def inMemory: IO[DatabaseClient[IO]] =
def inMemory[Id, Data]: IO[DatabaseClient[IO, Id, Data]] =
MapRef.ofShardedImmutableMap[IO, Id, Data](
shardCount = 5 // Arbitrary number of shards just for demonstration.
).map { mapRef =>
new DatabaseClient[IO] {
new DatabaseClient[IO, Id, Data] {
override def getDataById(id: Id): IO[Option[Data]] =
mapRef(id).get

Expand Down

0 comments on commit 33c93b1

Please sign in to comment.