Function "accessWashroom" currentTime code is incomplete. Something like: def accessWashroom(person: String, sem: Semaphore[IO]): IO[Unit] = for { t0 <- IO(System.currentTimeMillis()) _ <- IO(s"[+ 0 ms] $person wants to access the washroom, waiting for getting the access").trace _ <- sem.acquire t1 <- IO(System.currentTimeMillis()) _ <- IO(s"[+ \({t1 - t0} ms] \)person got access to washroom and using it now").trace _ <- IO.sleep(5.second) t2 <- IO(System.currentTimeMillis()) _ <- IO(s"[+ \({t2 - t0} ms] \)person left the washroom").trace _ <- sem.release } yield () does the job.