IO
run(args: List[String]): IO[ExitCode]
method.
IO.fromFuture(...runWith(Sink.foreach(println))).as[ExitCode.Success]
IOApp
is that it takes care of running the IO[ExitCode]
for you.
Sink.foreach
is calling println
, so you should see your output fine.
Future[Done]
, which has a thread that prints the ticks, right?
ExitCode.Failure
, IIRC, when the JVM halts, Linux (or macOS or whatever) will have its "errno" be -1, or somesuch.
if(condition) effect else IO(Unit)
where effect is IO[Unit]
. What's a better way to do this to avoid having to write else IO(Unit)
? Right now I just have a function def ifIO(condition: => Boolean, effect:IO[Unit]): IO[Unit]
to do that very thing, but I figure this is so simple it must have an idiomatic solution I'm missing.
condition.whenA(effect)
IO
to expose this as a method on the companion or even effect.whenA(cond)
as a method on IO