You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Whilst contributing to a cats-based codebase that makes extensive use of Iors (typelevel/grackle#96) I found myself needing a "addLeft" function, which given an Ior would either combine the new value with the existing LHS or in the case where it was a Right, turn it in to a Both with the new value on the left, ie
defaddLeft[A:Semigroup, B](ior: Ior[A,B], a: A):Ior[A, B] = ior match {
caseIor.Right(r) =>Both(a, r)
caseBoth(l, r) =>Both(l combine a, r)
caseIor.Left(l) =>Ior.left(l combine a)
}
Would this be something that would make sense to include within Cats itself?
The text was updated successfully, but these errors were encountered:
keirlawson
changed the title
addLeft/addRight convience methoids for Iors?
addLeft/addRight convenience methoids for Iors?
Nov 20, 2020
Whilst contributing to a cats-based codebase that makes extensive use of Iors (typelevel/grackle#96) I found myself needing a "addLeft" function, which given an Ior would either
combine
the new value with the existing LHS or in the case where it was aRight
, turn it in to aBoth
with the new value on the left, ieWould this be something that would make sense to include within Cats itself?
The text was updated successfully, but these errors were encountered: