Ryan Benasutti
08/04/2019, 4:03 AMIO.handleError { }
that doesn't require I provide an IO<A>
(perhaps one which requires an IO<Unit>
)? I have a method which returns an IO<A>
, but I need to guarantee certain additional IO operations happen if the former IO fails (and in this case, I can't return an IO<A>
because that part failed).raulraja
08/04/2019, 6:23 AMraulraja
08/04/2019, 6:23 AMsimon.vergauwen
08/04/2019, 12:50 PMRyan Benasutti
08/04/2019, 1:44 PMRyan Benasutti
08/04/2019, 1:45 PMinputFile
doesn't get deleted if the command fails (because it fails with an exception).simon.vergauwen
08/04/2019, 1:54 PMsimon.vergauwen
08/04/2019, 1:57 PMuse
fails it is guaranteed to go through release
.
It’s similar to try-with-resources
except that it works within IO
so it supports concurrency, parallelism, cancellation etc while guaranteeing resource safety 🙂Ryan Benasutti
08/04/2019, 1:58 PMbracketCase
is showing as an unresolved referencesimon.vergauwen
08/04/2019, 1:58 PMIO
on the classpath than you should also have bracketCase
IIRC.Ryan Benasutti
08/04/2019, 1:59 PMIO
has bracketCase
, yes, but IOEffect
does notsimon.vergauwen
08/04/2019, 1:59 PMIOEffect
? And IOEffect
should extend from Async
and thus also Bracket
.Ryan Benasutti
08/04/2019, 2:01 PMIOEffect
. Your code uses IO.effect
which resolves as fun Companion.effect(): IOEffect = object : arrow.effects.extensions.IOEffect { }
Ryan Benasutti
08/04/2019, 2:03 PMRyan Benasutti
08/04/2019, 2:03 PMeffect
is a zero argument method, but you pass it a lambdasimon.vergauwen
08/04/2019, 2:07 PMRyan Benasutti
08/04/2019, 2:07 PM0.9.0
simon.vergauwen
08/04/2019, 2:07 PMsimon.vergauwen
08/04/2019, 2:08 PMRyan Benasutti
08/04/2019, 2:11 PMeffect
and make a normal IO
then it workssimon.vergauwen
08/04/2019, 8:26 PM