kyleg
12/16/2019, 11:41 PMsuspend (File)->Unit function from a third party library. This function could throw if the file doesn't exist, or there aren't sufficient permissions, etc.
So it seems it should be wrapped in an IO.fx (because it interacts with IO and is a suspend fn) and also Either because it could succeed with Unit or fail with a Throwable.
I imagine this ought to be val result: IO<Either<Throwable, Unit>> = IO.fx { ... } but I'm having difficulty figuring out how to structure the block to return the expected result. If I don't care about the throwable I could just do IO.fx { effect { mySuspendFn() }.bind() }, but I'm trying to learn how to do all this "properly."