Closed tobyweston closed 6 years ago
For example,
import cats.implicits._ object IOs { def init(hosts: List[Host]) = { for { exists <- RrdFile.exists _ <- info(s"RRD initialising for ${hosts.map(_.name).mkString("'", "', '", "'")} (with up to $MaxSensors sensors each)...").unlessA(exists) _ <- IO(RrdFile(hosts, 30 seconds).create()).unlessA(exists) _ <- info("RRD initialised Ok").unlessA(exists) _ <- info(s"RRD initialised for ${hosts.map(_.name).mkString("'", "', '", "'")} (with up to $MaxSensors sensors each).").whenA(exists) } yield () } ... }
For example,