Hi, in arrow 0.11.0-snapshot (testing it, because ...
# arrow
h
Hi, in arrow 0.11.0-snapshot (testing it, because of BIO) in this code:
Copy code
fun validatePhotoMatch(login: Login, photo: ByteArray): IO<Error, Unit> =
    IO.monad<Error>().fx.monad {
      val user = !userService.getUserByLogin(login)
      val modelVectors = !extractFaceVectors(user)
      val unknownVectors = !recognitionService.calculatePhoto(photo)
      val resultDto = !recognitionService.calculateDifference(unknownVectors, modelVectors)
      !failureOrUnit(resultDto.result)
    }.fix()
I cannot make second line: as
IO.fx {
. Idea cannot decide if it should be:
Copy code
IO.Companion.fx(c: suspend IOSyntax<E>.() -> A): IO<E, A>
Or:
Copy code
IO.Companion.fx(c: suspend ConcurrentSyntax<IOPartialOf<Nothing>>.() -> A): IO<Nothing, A>
Is it some kind of bug with new IO being BIO? Or I do something bad? Type inference should see that there is Error on left side, not Nothing. (I use my own Error class in ADT) Every method used in for-comprehension is returning
IO<Error, x>
Arrow Gradle deps are:
Copy code
val arrowVersion = "0.11.0-SNAPSHOT"
	implementation("io.arrow-kt:arrow-fx:$arrowVersion")
	implementation("io.arrow-kt:arrow-fx-reactor:$arrowVersion")
	implementation("io.arrow-kt:arrow-mtl:$arrowVersion")
	implementation("io.arrow-kt:arrow-mtl-data:$arrowVersion")
	implementation("io.arrow-kt:arrow-syntax:$arrowVersion")
	implementation("io.arrow-kt:arrow-integration-retrofit-adapter:$arrowVersion")
	kapt("io.arrow-kt:arrow-meta:$arrowVersion")
And second: Maybe add function
Either<E, A>.toIO<E, A>()
? There are already functions that map left side of Either to “below” side of IO, but I couldn’t see any mapping Either left to IO left. In BIO it would be very easy. I have written it for my own purpose and can push pull-request to 0.11.0 branch ;)
a
Hello! I bumped into the exact same thing last night. This is what I came up with, it's less than elegant: https://github.com/adomokos/kotlin-sandbox/blob/upgrade-arrow/src/test/kotlin/sandbox/arrow/ReaderSpec.kt#L35-L37
h
Thank you, I resolved that in next channel topic 😉