kyleg
12/24/2019, 5:47 PMImageIO.read here. I understand it probably wants me to put this in a suspend fn and it’s just a linting thing. But since it’s in an IO.fx and has !bind  wrapped around it, I should ignore this linting warning, right? That’s part of the point of IO and !effect, right?
fun imageReader(file: File): IO<Either<Throwable, ByteArray>> = IO.fx {
    with(!effect { ImageIO.read(file) }) {
        val argbArray = getRGB(0,0, width, height,null,0, width)
        val buffer = java.nio.ByteBuffer.allocate(4*argbArray.size)
        argbArray.forEach { buffer.putInt(it) }
        buffer.flip()
        buffer.array().slice(0 until argbArray.size*4).toByteArray()
    }
}.attempt()stojan
12/24/2019, 6:39 PMinputStream.close() inside IO {}raulraja
12/24/2019, 11:59 PMkyleg
12/26/2019, 4:31 AMkyleg
12/26/2019, 4:33 AMkyleg
12/26/2019, 4:34 AM