Also you could remove the `IO.run` if you use `IO....
# arrow
s
Also you could remove the
IO.run
if you use
IO.raiseError
instead. You’re already import binding for io directly with
import arrow.effects.extensions.io.monad.binding
🙂
b
not sure I understand that
s
You could rewrite
work
as
Copy code
fun work(s: String): IO<Obj> =
        binding {
            val output = apiCall(s)
            val obj = convert(output.bind())
            obj ?: IO.raiseError<Obj>(DecodingError)
    }
Since you already import
binding
directly. And you’re only using
raiseError
which is directly available on
IO.Companion
2.
b
that works, thanks
👍 1