@@ -985,6 +985,55 @@ sealed abstract private[data] class IorInstances0 {
985985
986986 override def map [B , C ](fa : A Ior B )(f : B => C ): A Ior C =
987987 fa.map(f)
988+
989+ override def as [B , C ](fa : A Ior B , c : C ): A Ior C =
990+ fa match {
991+ case Ior .Left (_) => fa.asInstanceOf [A Ior C ]
992+ case Ior .Right (_) => Ior .Right (c)
993+ case Ior .Both (a, _) => Ior .Both (a, c)
994+ }
995+
996+ override def tupleLeft [B , C ](fa : A Ior B , c : C ): A Ior (C , B ) =
997+ fa match {
998+ case Ior .Left (_) => fa.asInstanceOf [A Ior (C , B )]
999+ case Ior .Right (b) => Ior .Right ((c, b))
1000+ case Ior .Both (a, b) => Ior .Both (a, (c, b))
1001+ }
1002+
1003+ override def tupleRight [B , C ](fa : A Ior B , c : C ): A Ior (B , C ) =
1004+ fa match {
1005+ case Ior .Left (_) => fa.asInstanceOf [A Ior (B , C )]
1006+ case Ior .Right (b) => Ior .Right ((b, c))
1007+ case Ior .Both (a, b) => Ior .Both (a, (b, c))
1008+ }
1009+
1010+ override def fproduct [B , C ](fa : A Ior B )(f : B => C ): A Ior (B , C ) =
1011+ fa match {
1012+ case Ior .Left (_) => fa.asInstanceOf [A Ior (B , C )]
1013+ case Ior .Right (b) => Ior .Right ((b, f(b)))
1014+ case Ior .Both (a, b) => Ior .Both (a, (b, f(b)))
1015+ }
1016+
1017+ override def fproductLeft [B , C ](fa : A Ior B )(f : B => C ): A Ior (C , B ) =
1018+ fa match {
1019+ case Ior .Left (_) => fa.asInstanceOf [A Ior (C , B )]
1020+ case Ior .Right (b) => Ior .Right ((f(b), b))
1021+ case Ior .Both (a, b) => Ior .Both (a, (f(b), b))
1022+ }
1023+
1024+ override def unzip [B , C ](fab : A Ior (B , C )): (A Ior B , A Ior C ) =
1025+ fab match {
1026+ case Ior .Left (a) => (Ior .Left (a), Ior .Left (a))
1027+ case Ior .Right ((b, c)) => (Ior .Right (b), Ior .Right (c))
1028+ case Ior .Both (a, (b, c)) => (Ior .Both (a, b), Ior .Both (a, c))
1029+ }
1030+
1031+ override def void [B ](fa : A Ior B ): A Ior Unit =
1032+ fa match {
1033+ case Ior .Left (_) => fa.asInstanceOf [A Ior Unit ]
1034+ case Ior .Right (_) => Ior .Right (())
1035+ case Ior .Both (a, _) => Ior .Both (a, ())
1036+ }
9881037 }
9891038
9901039 implicit def catsDataEqForIor [A : Eq , B : Eq ]: Eq [A Ior B ] = _ === _
0 commit comments