gabib
08/02/2023, 2:49 PM1.2.0
.
I’m using a type alias for a NonEmptyList
that looks like this typealias ApplicationErrors = NonEmptyList<ApplicationError>
, however when used together with the either
DSL and parZipOrAccumulate
the code fails to compile.
suspend fun getDetails(param: Param): Either<ApplicationErrors, User> =
either {
parZipOrAccumulate(
{ serviceOne.getUser(param).bind() },
{ serviceTwo.getUserDetails(param).bind() },
{ serviceThree.getUserPermissions(param).bind() }
) { user, details, permissions ->
// do something with the user
}
}
If I just change the return type from Either<ApplicationErrors, User>
to Either<Nel<ApplicationError>, User>
everything works as expected.
I wasn’t expecting this to happen, any idea why? Thank you!dave08
08/02/2023, 2:52 PMgabib
08/02/2023, 2:54 PMApplicationErrors
is a typealias for a NonEmptyList<ApplicationError>
dave08
08/02/2023, 2:57 PMsimon.vergauwen
08/28/2023, 6:32 AMIf I just change the return type fromWow, that is very strange 🤯 Did you ever find out what was happening here? What Kotlin version are you on? I was out in August but Arrow 1.2.1 with Kotlin 1.9.x should get released this weektoEither<ApplicationErrors, User>
everything works as expected.Either<Nel<ApplicationError>, User>