rcd27
08/19/2022, 6:16 PMAddressContactInfo. What is a better FP way to do that?rcd27
08/19/2022, 6:21 PMrcd27
08/19/2022, 6:25 PMLukasz Kalnik
08/20/2022, 7:36 PMfilter { it.contactInfo.isRight || it.contactInfo.isBoth }Lukasz Kalnik
08/20/2022, 7:37 PMfold in your example you have basically reimplemented filter 😉Lukasz Kalnik
08/20/2022, 7:46 PMOption types for address/email contact info in the Contact data class? Ior is right-biased, which means AddressContactInfo is privileged over EmailContactInfo.
Or is it just an abstract example?simon.vergauwen
08/22/2022, 8:16 AMior binding for this.
ior(semigroup) {
listOf(
contactWithAddres,
contactWithMail
).map { it.contactInfo.bind() }
}
}simon.vergauwen
08/22/2022, 8:17 AMisLeft short-circuits like Either.Left but isBoth accumulates the E and return` Right`simon.vergauwen
08/22/2022, 8:17 AMisRight behaves just like Either.Rightrcd27
08/29/2022, 6:38 PMIor was that it represent either left, or right, or both. And I still don't know how to model that by hands, Nullability of those two values means that there is a 4th case: both missing, which is not valid for this case.rcd27
08/29/2022, 6:39 PMIor is not the best solution for my example, as it is right-biased, which is something I don't need.Lukasz Kalnik
08/30/2022, 6:43 AMNonEmptyList?