@@ -122,7 +122,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
122122 case None => gb
123123 }
124124 }
125- Defer [G ].defer(loop(Source .fromFoldable(fa)(self)))
125+ Defer [G ].defer(loop(Source .fromFoldable(fa)(using self)))
126126 }
127127
128128 def reduceLeftToOption [A , B ](fa : F [A ])(f : A => B )(g : (B , A ) => B ): Option [B ] =
@@ -132,7 +132,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
132132 }
133133
134134 def reduceRightToOption [A , B ](fa : F [A ])(f : A => B )(g : (A , Eval [B ]) => Eval [B ]): Eval [Option [B ]] = {
135- Source .fromFoldable(fa)(self).uncons match {
135+ Source .fromFoldable(fa)(using self).uncons match {
136136 case Some ((first, s)) =>
137137 def loop (now : A , source : Source [A ]): Eval [B ] =
138138 source.uncons match {
@@ -241,7 +241,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
241241 * @see [[maximumByOption ]] for maximum instead of minimum.
242242 */
243243 def minimumByOption [A , B : Order ](fa : F [A ])(f : A => B ): Option [A ] =
244- minimumOption(fa)(Order .by(f))
244+ minimumOption(fa)(using Order .by(f))
245245
246246 /**
247247 * Find the maximum `A` item in this structure according to an `Order.by(f)`.
@@ -255,7 +255,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
255255 * @see [[minimumByOption ]] for minimum instead of maximum.
256256 */
257257 def maximumByOption [A , B : Order ](fa : F [A ])(f : A => B ): Option [A ] =
258- maximumOption(fa)(Order .by(f))
258+ maximumOption(fa)(using Order .by(f))
259259
260260 /**
261261 * Find all the minimum `A` items in this structure.
@@ -299,7 +299,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
299299 * @see [[maximumByList ]] for maximum instead of minimum.
300300 */
301301 def minimumByList [A , B : Order ](fa : F [A ])(f : A => B ): List [A ] =
302- minimumList(fa)(Order .by(f))
302+ minimumList(fa)(using Order .by(f))
303303
304304 /**
305305 * Find all the maximum `A` items in this structure according to an `Order.by(f)`.
@@ -311,7 +311,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
311311 * @see [[minimumByList ]] for minimum instead of maximum.
312312 */
313313 def maximumByList [A , B : Order ](fa : F [A ])(f : A => B ): List [A ] =
314- maximumList(fa)(Order .by(f))
314+ maximumList(fa)(using Order .by(f))
315315
316316 def sumAll [A ](fa : F [A ])(implicit A : Numeric [A ]): A =
317317 foldLeft(fa, A .zero)(A .plus)
@@ -390,7 +390,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
390390 */
391391
392392 def collectFirstSomeM [G [_], A , B ](fa : F [A ])(f : A => G [Option [B ]])(implicit G : Monad [G ]): G [Option [B ]] =
393- G .tailRecM(Foldable .Source .fromFoldable(fa)(self))(_.uncons match {
393+ G .tailRecM(Foldable .Source .fromFoldable(fa)(using self))(_.uncons match {
394394 case Some ((a, src)) =>
395395 G .map(f(a)) {
396396 case None => Left (src.value)
@@ -474,7 +474,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
474474 * in terms of `foldRight`.
475475 */
476476 def foldM [G [_], A , B ](fa : F [A ], z : B )(f : (B , A ) => G [B ])(implicit G : Monad [G ]): G [B ] = {
477- val src = Foldable .Source .fromFoldable(fa)(self)
477+ val src = Foldable .Source .fromFoldable(fa)(using self)
478478 G .tailRecM((z, src)) { case (b, src) =>
479479 src.uncons match {
480480 case Some ((a, src)) => G .map(f(b, a))(b => Left ((b, src.value)))
@@ -647,7 +647,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
647647 * }}}
648648 */
649649 def foldK [G [_], A ](fga : F [G [A ]])(implicit G : MonoidK [G ]): G [A ] =
650- fold(fga)(G .algebra)
650+ fold(fga)(using G .algebra)
651651
652652 /**
653653 * Find the first element matching the predicate, if one exists.
@@ -680,7 +680,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
680680 */
681681
682682 def findM [G [_], A ](fa : F [A ])(p : A => G [Boolean ])(implicit G : Monad [G ]): G [Option [A ]] =
683- G .tailRecM(Foldable .Source .fromFoldable(fa)(self))(_.uncons match {
683+ G .tailRecM(Foldable .Source .fromFoldable(fa)(using self))(_.uncons match {
684684 case Some ((a, src)) => G .map(p(a))(if (_) Right (Some (a)) else Left (src.value))
685685 case None => G .pure(Right (None ))
686686 })
@@ -729,7 +729,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
729729 * }}}
730730 */
731731 def existsM [G [_], A ](fa : F [A ])(p : A => G [Boolean ])(implicit G : Monad [G ]): G [Boolean ] =
732- G .tailRecM(Foldable .Source .fromFoldable(fa)(self)) { src =>
732+ G .tailRecM(Foldable .Source .fromFoldable(fa)(using self)) { src =>
733733 src.uncons match {
734734 case Some ((a, src)) => G .map(p(a))(bb => if (bb) Right (true ) else Left (src.value))
735735 case None => G .pure(Right (false ))
@@ -764,7 +764,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
764764 * }}}
765765 */
766766 def forallM [G [_], A ](fa : F [A ])(p : A => G [Boolean ])(implicit G : Monad [G ]): G [Boolean ] =
767- G .tailRecM(Foldable .Source .fromFoldable(fa)(self)) { src =>
767+ G .tailRecM(Foldable .Source .fromFoldable(fa)(using self)) { src =>
768768 src.uncons match {
769769 case Some ((a, src)) => G .map(p(a))(bb => if (! bb) Right (false ) else Left (src.value))
770770 case None => G .pure(Right (true ))
@@ -853,7 +853,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
853853 * }}}
854854 */
855855 def intercalate [A ](fa : F [A ], a : A )(implicit A : Monoid [A ]): A =
856- combineAllOption(fa)(A .intercalate(a)) match {
856+ combineAllOption(fa)(using A .intercalate(a)) match {
857857 case None => A .empty
858858 case Some (a) => a
859859 }
@@ -958,7 +958,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s
958958 fa : F [A ]
959959 )(f : A => G [Either [B , C ]])(implicit A : Alternative [F ], M : Monad [G ]): G [(F [B ], F [C ])] = {
960960 import cats .instances .either .*
961- partitionBifoldM[G , Either , A , B , C ](fa)(f)(A , M , Bifoldable [Either ])
961+ partitionBifoldM[G , Either , A , B , C ](fa)(f)(using A , M , Bifoldable [Either ])
962962 }
963963}
964964
@@ -1041,38 +1041,38 @@ object Foldable {
10411041 typeClassInstance.reduceRightToOption[A , B ](self)(f)(g)
10421042 def reduceLeftOption (f : (A , A ) => A ): Option [A ] = typeClassInstance.reduceLeftOption[A ](self)(f)
10431043 def reduceRightOption (f : (A , Eval [A ]) => Eval [A ]): Eval [Option [A ]] = typeClassInstance.reduceRightOption[A ](self)(f)
1044- def minimumOption (implicit A : Order [A ]): Option [A ] = typeClassInstance.minimumOption[A ](self)(A )
1045- def maximumOption (implicit A : Order [A ]): Option [A ] = typeClassInstance.maximumOption[A ](self)(A )
1044+ def minimumOption (implicit A : Order [A ]): Option [A ] = typeClassInstance.minimumOption[A ](self)(using A )
1045+ def maximumOption (implicit A : Order [A ]): Option [A ] = typeClassInstance.maximumOption[A ](self)(using A )
10461046 def minimumByOption [B ](f : A => B )(implicit ev$1 : Order [B ]): Option [A ] =
10471047 typeClassInstance.minimumByOption[A , B ](self)(f)
10481048 def maximumByOption [B ](f : A => B )(implicit ev$1 : Order [B ]): Option [A ] =
10491049 typeClassInstance.maximumByOption[A , B ](self)(f)
1050- def minimumList (implicit A : Order [A ]): List [A ] = typeClassInstance.minimumList[A ](self)(A )
1051- def maximumList (implicit A : Order [A ]): List [A ] = typeClassInstance.maximumList[A ](self)(A )
1050+ def minimumList (implicit A : Order [A ]): List [A ] = typeClassInstance.minimumList[A ](self)(using A )
1051+ def maximumList (implicit A : Order [A ]): List [A ] = typeClassInstance.maximumList[A ](self)(using A )
10521052 def minimumByList [B ](f : A => B )(implicit ev$1 : Order [B ]): List [A ] = typeClassInstance.minimumByList[A , B ](self)(f)
10531053 def maximumByList [B ](f : A => B )(implicit ev$1 : Order [B ]): List [A ] = typeClassInstance.maximumByList[A , B ](self)(f)
10541054 def get (idx : Long ): Option [A ] = typeClassInstance.get[A ](self)(idx)
10551055 def collectFirst [B ](pf : PartialFunction [A , B ]): Option [B ] = typeClassInstance.collectFirst[A , B ](self)(pf)
10561056 def collectFirstSome [B ](f : A => Option [B ]): Option [B ] = typeClassInstance.collectFirstSome[A , B ](self)(f)
10571057 def collectFoldSome [B ](f : A => Option [B ])(implicit B : Monoid [B ]): B =
1058- typeClassInstance.collectFoldSome[A , B ](self)(f)(B )
1059- def fold (implicit A : Monoid [A ]): A = typeClassInstance.fold[A ](self)(A )
1058+ typeClassInstance.collectFoldSome[A , B ](self)(f)(using B )
1059+ def fold (implicit A : Monoid [A ]): A = typeClassInstance.fold[A ](self)(using A )
10601060 def sumAll (implicit A : Numeric [A ]): A = typeClassInstance.sumAll[A ](self)
10611061 def productAll (implicit A : Numeric [A ]): A = typeClassInstance.productAll[A ](self)
10621062 def combineAll (implicit ev$1 : Monoid [A ]): A = typeClassInstance.combineAll[A ](self)
1063- def combineAllOption (implicit ev : Semigroup [A ]): Option [A ] = typeClassInstance.combineAllOption[A ](self)(ev)
1063+ def combineAllOption (implicit ev : Semigroup [A ]): Option [A ] = typeClassInstance.combineAllOption[A ](self)(using ev)
10641064 def toIterable : Iterable [A ] = typeClassInstance.toIterable[A ](self)
1065- def foldMap [B ](f : A => B )(implicit B : Monoid [B ]): B = typeClassInstance.foldMap[A , B ](self)(f)(B )
1065+ def foldMap [B ](f : A => B )(implicit B : Monoid [B ]): B = typeClassInstance.foldMap[A , B ](self)(f)(using B )
10661066 def foldM [G [_], B ](z : B )(f : (B , A ) => G [B ])(implicit G : Monad [G ]): G [B ] =
1067- typeClassInstance.foldM[G , A , B ](self, z)(f)(G )
1067+ typeClassInstance.foldM[G , A , B ](self, z)(f)(using G )
10681068 final def foldLeftM [G [_], B ](z : B )(f : (B , A ) => G [B ])(implicit G : Monad [G ]): G [B ] =
1069- typeClassInstance.foldLeftM[G , A , B ](self, z)(f)(G )
1069+ typeClassInstance.foldLeftM[G , A , B ](self, z)(f)(using G )
10701070 def foldMapM [G [_], B ](f : A => G [B ])(implicit G : Monad [G ], B : Monoid [B ]): G [B ] =
1071- typeClassInstance.foldMapM[G , A , B ](self)(f)(G , B )
1071+ typeClassInstance.foldMapM[G , A , B ](self)(f)(using G , B )
10721072 def foldMapA [G [_], B ](f : A => G [B ])(implicit G : Applicative [G ], B : Monoid [B ]): G [B ] =
1073- typeClassInstance.foldMapA[G , A , B ](self)(f)(G , B )
1073+ typeClassInstance.foldMapA[G , A , B ](self)(f)(using G , B )
10741074 def traverseVoid [G [_], B ](f : A => G [B ])(implicit G : Applicative [G ]): G [Unit ] =
1075- typeClassInstance.traverseVoid[G , A , B ](self)(f)(G )
1075+ typeClassInstance.traverseVoid[G , A , B ](self)(f)(using G )
10761076 def traverse_ [G [_], B ](f : A => G [B ])(implicit G : Applicative [G ]): G [Unit ] =
10771077 traverseVoid[G , B ](f)
10781078 // TODO: looks like these two methods below duplicate the same named methods from `NestedFoldableOps`.
@@ -1083,19 +1083,19 @@ object Foldable {
10831083 def sequence_ [G [_], B ](implicit ev$1 : A <:< G [B ], ev$2 : Applicative [G ]): G [Unit ] =
10841084 sequenceVoid[G , B ]
10851085 def foldK [G [_], B ](implicit ev$1 : A <:< G [B ], G : MonoidK [G ]): G [B ] =
1086- typeClassInstance.foldK[G , B ](self.asInstanceOf [F [G [B ]]])(G )
1086+ typeClassInstance.foldK[G , B ](self.asInstanceOf [F [G [B ]]])(using G )
10871087 def find (f : A => Boolean ): Option [A ] = typeClassInstance.find[A ](self)(f)
10881088 def existsM [G [_]](p : A => G [Boolean ])(implicit G : Monad [G ]): G [Boolean ] =
1089- typeClassInstance.existsM[G , A ](self)(p)(G )
1089+ typeClassInstance.existsM[G , A ](self)(p)(using G )
10901090 def forallM [G [_]](p : A => G [Boolean ])(implicit G : Monad [G ]): G [Boolean ] =
1091- typeClassInstance.forallM[G , A ](self)(p)(G )
1091+ typeClassInstance.forallM[G , A ](self)(p)(using G )
10921092 def toList : List [A ] = typeClassInstance.toList[A ](self)
10931093 def partitionEither [B , C ](f : A => Either [B , C ])(implicit A : Alternative [F ]): (F [B ], F [C ]) =
1094- typeClassInstance.partitionEither[A , B , C ](self)(f)(A )
1094+ typeClassInstance.partitionEither[A , B , C ](self)(f)(using A )
10951095 def filter_ (p : A => Boolean ): List [A ] = typeClassInstance.filter_[A ](self)(p)
10961096 def takeWhile_ (p : A => Boolean ): List [A ] = typeClassInstance.takeWhile_[A ](self)(p)
10971097 def dropWhile_ (p : A => Boolean ): List [A ] = typeClassInstance.dropWhile_[A ](self)(p)
1098- def intercalate (a : A )(implicit A : Monoid [A ]): A = typeClassInstance.intercalate[A ](self, a)(A )
1098+ def intercalate (a : A )(implicit A : Monoid [A ]): A = typeClassInstance.intercalate[A ](self, a)(using A )
10991099 }
11001100 trait AllOps [F [_], A ] extends Ops [F , A ] with UnorderedFoldable .AllOps [F , A ] {
11011101 type TypeClassType <: Foldable [F ]
0 commit comments