Hello Arrow folks! I've upgraded to `v0.10.5` and ...
# arrow
a
Hello Arrow folks! I've upgraded to
v0.10.5
and my project failed to compile. I was surprised by this, as it was a patch-level bump. Looking deeper, I found that
EitherT
has changed. Do you have some updated examples on how to
EitherT
with this new version? Here is one function that fails to compile:
Copy code
private fun readConfiguration(): EitherIO<T.Configuration> =
        EitherT(IO.fx {
            val config = T.Configuration(
                System.getenv("CLIENT_ID"),
                System.getenv("CLIENT_SECRET"))
            Right(config)
        }.handleError { Left("No CLIENT_ID or CLIENT_SECRET was found") })
The error is:
Required: String, Found: ForIO
. I've been going through the 0.10.5 changelog, looking at EitherT specific commits, but I couldn't find the cure for this error. Any and all help would be appreciated!
j
EitherT has only changed in 2 ways: • The generic argument order changed:
EitherT<F, L, A> -> EitherT<L, F, A>
• The
MonadError
instance changed from
MonadError<EitherTPartialOf<L, F>, E> -> MonadError<EitherTPartialOf<L, F>, L>
Apart from that everything stayed as is
a
I did see that. Thanks @Jannis. How could I fix this function I included? Sorry for the newbie q.
j
Well how exactly is
T.Configuration
and
EitherTIO
defined?
a
Sorry, I had
EitherIO
in my original q, but took it out. This is `EitherIO`:
Copy code
typealias EitherIO<A> = EitherT<ForIO, String, A>
And
Configuration
is a simple data class:
Copy code
data class Configuration(val clientId: String, val clientSecret: String)
j
Ah thats easy then: Just change
typealias EitherIO<A> = EitherT<ForIO, String, A> -> typealias EitherIO<A> = EitherT<String, ForIO, A>
because the definition changed.
a
That worked! Thanks for the support, @Jannis!!