Skip to content

Commit

Permalink
Merge pull request #11 from efemelar/documentation-fix-supervised-sco…
Browse files Browse the repository at this point in the history
…ped-example

Fix supervised/scoped code example
  • Loading branch information
adamw authored Sep 29, 2023
2 parents 5bafe11 + a74a39e commit 3b6f687
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -291,15 +291,16 @@ supervised {
Resources can also be used in a dedicated scope:

```scala
import ox.useScoped
import ox.useSupervised

case class MyResource(c: Int)

def acquire: MyResource =
println("acquiring ...")
MyResource(5)
def acquire(c: Int): MyResource =
println(s"acquiring $c ...")
MyResource(c)

def release(resource: MyResource): Unit =
println(s"releasing ${resource.c}...")
println(s"releasing ${resource.c} ...")

useSupervised(acquire(10))(release) { resource =>
println(s"Using $resource ...")
Expand Down

0 comments on commit 3b6f687

Please sign in to comment.