Skip to content

Commit

Permalink
Run kind-projector Scalafix rules and format
Browse files Browse the repository at this point in the history
  • Loading branch information
travisbrown committed Dec 4, 2019
1 parent f304311 commit ef1c482
Show file tree
Hide file tree
Showing 83 changed files with 1,446 additions and 966 deletions.
10 changes: 5 additions & 5 deletions alleycats-core/src/main/scala/alleycats/std/map.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ object map extends MapInstances
trait MapInstances {

// toList is inconsistent. See https://github.com/typelevel/cats/issues/1831
implicit def alleycatsStdInstancesForMap[K]: Traverse[Map[K, *]] =
new Traverse[Map[K, *]] {
implicit def alleycatsStdInstancesForMap[K]: Traverse[({ type λ[α$] = Map[K, α$] })#λ] =
new Traverse[({ type λ[α$] = Map[K, α$] })#λ] {

def traverse[G[_], A, B](fa: Map[K, A])(f: A => G[B])(implicit G: Applicative[G]): G[Map[K, B]] = {
val gba: Eval[G[Map[K, B]]] = Always(G.pure(Map.empty))
Expand Down Expand Up @@ -59,9 +59,9 @@ trait MapInstances {
collectFirst(fa)(Function.unlift(f))
}

implicit def alleycatsStdMapTraverseFilter[K]: TraverseFilter[Map[K, *]] =
new TraverseFilter[Map[K, *]] {
def traverse: Traverse[Map[K, *]] = alleycatsStdInstancesForMap
implicit def alleycatsStdMapTraverseFilter[K]: TraverseFilter[({ type λ[α$] = Map[K, α$] })#λ] =
new TraverseFilter[({ type λ[α$] = Map[K, α$] })#λ] {
def traverse: Traverse[({ type λ[α$] = Map[K, α$] })#λ] = alleycatsStdInstancesForMap

def traverseFilter[G[_], A, B](fa: Map[K, A])(f: A => G[Option[B]])(implicit G: Applicative[G]): G[Map[K, B]] = {
val gba: Eval[G[Map[K, B]]] = Always(G.pure(Map.empty))
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala-2.12/cats/data/OneAndLowPriority4.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import scala.annotation.tailrec
import scala.collection.mutable.Builder

abstract private[data] class OneAndLowPriority4 {
implicit val catsDataComonadForNonEmptyStream: Comonad[OneAnd[Stream, *]] =
new Comonad[OneAnd[Stream, *]] {
implicit val catsDataComonadForNonEmptyStream: Comonad[({ type λ[α$] = OneAnd[Stream, α$] })#λ] =
new Comonad[({ type λ[α$] = OneAnd[Stream, α$] })#λ] {
def coflatMap[A, B](fa: OneAnd[Stream, A])(f: OneAnd[Stream, A] => B): OneAnd[Stream, B] = {
@tailrec def consume(as: Stream[A], buf: Builder[B, Stream[B]]): Stream[B] =
if (as.isEmpty) buf.result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import cats.{NonEmptyParallel, Parallel}
trait ParallelInstances extends ParallelInstances1 {

@deprecated("Use cats.instances.either.catsParallelForEitherAndValidated", "2.1.0")
def catsParallelForEitherValidated[E: Semigroup]: Parallel.Aux[Either[E, *], Validated[E, *]] =
def catsParallelForEitherValidated[E: Semigroup]
: Parallel.Aux[({ type λ[α$] = Either[E, α$] })#λ, ({ type λ[α$] = Validated[E, α$] })#λ] =
cats.instances.either.catsParallelForEitherAndValidated[E]

@deprecated("Use OptionT.catsDataParallelForOptionT", "2.0.0")
def catsParallelForOptionTNestedOption[M[_]](
implicit P: Parallel[M]
): Parallel.Aux[OptionT[M, *], Nested[P.F, Option, *]] = OptionT.catsDataParallelForOptionT[M]
): Parallel.Aux[({ type λ[α$] = OptionT[M, α$] })#λ, ({ type λ[α$] = Nested[P.F, Option, α$] })#λ] =
OptionT.catsDataParallelForOptionT[M]

@deprecated("Use cats.instances.list.catsStdNonEmptyParallelForListZipList", "2.1.0")
def catsStdNonEmptyParallelForZipList: NonEmptyParallel.Aux[List, ZipList] =
Expand All @@ -31,6 +33,7 @@ trait ParallelInstances extends ParallelInstances1 {
@deprecated("Use EitherT.catsDataParallelForEitherTWithParallelEffect", "2.0.0")
def catsParallelForEitherTNestedParallelValidated[M[_], E: Semigroup](
implicit P: Parallel[M]
): Parallel.Aux[EitherT[M, E, *], Nested[P.F, Validated[E, *], *]] =
): Parallel.Aux[({ type λ[α$] = EitherT[M, E, α$] })#λ,
({ type λ[α$] = Nested[P.F, ({ type λ[α$$] = Validated[E, α$$] })#λ, α$] })#λ] =
EitherT.catsDataParallelForEitherTWithParallelEffect[M, E]
}
4 changes: 2 additions & 2 deletions core/src/main/scala-2.12/cats/instances/stream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -176,10 +176,10 @@ trait StreamInstances extends cats.kernel.instances.StreamInstances {
def applicative: Applicative[ZipStream] = ZipStream.catsDataAlternativeForZipStream

def sequential: ZipStream ~> Stream =
λ[ZipStream ~> Stream](_.value)
new (ZipStream ~> Stream) { def apply[A$](a$ : ZipStream[A$]): Stream[A$] = a$.value }

def parallel: Stream ~> ZipStream =
λ[Stream ~> ZipStream](v => new ZipStream(v))
new (Stream ~> ZipStream) { def apply[A$](v: Stream[A$]): ZipStream[A$] = new ZipStream(v) }
}
}

Expand Down
20 changes: 12 additions & 8 deletions core/src/main/scala-2.13+/cats/data/NonEmptyLazyList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -377,21 +377,25 @@ sealed abstract private[data] class NonEmptyLazyListInstances extends NonEmptyLa
implicit def catsDataShowForNonEmptyLazyList[A](implicit A: Show[A]): Show[NonEmptyLazyList[A]] =
Show.show[NonEmptyLazyList[A]](nell => s"NonEmpty${Show[LazyList[A]].show(nell.toLazyList)}")

implicit def catsDataParallelForNonEmptyLazyList: Parallel.Aux[NonEmptyLazyList, OneAnd[ZipLazyList, *]] =
implicit def catsDataParallelForNonEmptyLazyList
: Parallel.Aux[NonEmptyLazyList, ({ type λ[α$] = OneAnd[ZipLazyList, α$] })#λ] =
new Parallel[NonEmptyLazyList] {
type F[x] = OneAnd[ZipLazyList, x]

def applicative: Applicative[OneAnd[ZipLazyList, *]] =
def applicative: Applicative[({ type λ[α$] = OneAnd[ZipLazyList, α$] })#λ] =
OneAnd.catsDataApplicativeForOneAnd(ZipLazyList.catsDataAlternativeForZipLazyList)
def monad: Monad[NonEmptyLazyList] = NonEmptyLazyList.catsDataInstancesForNonEmptyLazyList

def sequential: OneAnd[ZipLazyList, *] ~> NonEmptyLazyList =
λ[OneAnd[ZipLazyList, *] ~> NonEmptyLazyList](
znell => NonEmptyLazyList.fromLazyListPrepend(znell.head, znell.tail.value)
)
def sequential: ({ type λ[α$] = OneAnd[ZipLazyList, α$] })#λ ~> NonEmptyLazyList =
new (({ type λ[α$] = OneAnd[ZipLazyList, α$] })#λ ~> NonEmptyLazyList) {
def apply[A$](znell: OneAnd[ZipLazyList, A$]): NonEmptyLazyList[A$] =
NonEmptyLazyList.fromLazyListPrepend(znell.head, znell.tail.value)
}

def parallel: NonEmptyLazyList ~> OneAnd[ZipLazyList, *] =
λ[NonEmptyLazyList ~> OneAnd[ZipLazyList, *]](nell => OneAnd(nell.head, ZipLazyList(nell.tail)))
def parallel: NonEmptyLazyList ~> ({ type λ[α$] = OneAnd[ZipLazyList, α$] })#λ =
new (NonEmptyLazyList ~> ({ type λ[α$] = OneAnd[ZipLazyList, α$] })#λ) {
def apply[A$](nell: NonEmptyLazyList[A$]): OneAnd[ZipLazyList, A$] = OneAnd(nell.head, ZipLazyList(nell.tail))
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala-2.13+/cats/data/OneAndLowPriority4.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import scala.collection.mutable.Builder

abstract private[data] class OneAndLowPriority4 {
@deprecated("Use catsDataComonadForNonEmptyLazyList", "2.0.0-RC2")
implicit def catsDataComonadForNonEmptyStream: Comonad[OneAnd[Stream, *]] =
new Comonad[OneAnd[Stream, *]] {
implicit def catsDataComonadForNonEmptyStream: Comonad[({ type λ[α$] = OneAnd[Stream, α$] })#λ] =
new Comonad[({ type λ[α$] = OneAnd[Stream, α$] })#λ] {
def coflatMap[A, B](fa: OneAnd[Stream, A])(f: OneAnd[Stream, A] => B): OneAnd[Stream, B] = {
@tailrec def consume(as: Stream[A], buf: Builder[B, Stream[B]]): Stream[B] =
if (as.isEmpty) buf.result
Expand All @@ -25,8 +25,8 @@ abstract private[data] class OneAndLowPriority4 {
fa.map(f)(cats.instances.stream.catsStdInstancesForStream)
}

implicit val catsDataComonadForNonEmptyLazyList: Comonad[OneAnd[LazyList, *]] =
new Comonad[OneAnd[LazyList, *]] {
implicit val catsDataComonadForNonEmptyLazyList: Comonad[({ type λ[α$] = OneAnd[LazyList, α$] })#λ] =
new Comonad[({ type λ[α$] = OneAnd[LazyList, α$] })#λ] {
def coflatMap[A, B](fa: OneAnd[LazyList, A])(f: OneAnd[LazyList, A] => B): OneAnd[LazyList, B] = {
@tailrec def consume(as: LazyList[A], buf: Builder[B, LazyList[B]]): LazyList[B] =
if (as.isEmpty) buf.result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import cats.{NonEmptyParallel, Parallel}
trait ParallelInstances extends ParallelInstances1 {

@deprecated("Use cats.instances.either.catsParallelForEitherAndValidated", "2.1.0")
def catsParallelForEitherValidated[E: Semigroup]: Parallel.Aux[Either[E, *], Validated[E, *]] =
def catsParallelForEitherValidated[E: Semigroup]
: Parallel.Aux[({ type λ[α$] = Either[E, α$] })#λ, ({ type λ[α$] = Validated[E, α$] })#λ] =
cats.instances.either.catsParallelForEitherAndValidated[E]

@deprecated("Use OptionT.catsDataParallelForOptionT", "2.0.0")
def catsParallelForOptionTNestedOption[M[_]](
implicit P: Parallel[M]
): Parallel.Aux[OptionT[M, *], Nested[P.F, Option, *]] = OptionT.catsDataParallelForOptionT[M]
): Parallel.Aux[({ type λ[α$] = OptionT[M, α$] })#λ, ({ type λ[α$] = Nested[P.F, Option, α$] })#λ] =
OptionT.catsDataParallelForOptionT[M]

@deprecated("Use cats.instances.list.catsStdNonEmptyParallelForListZipList", "2.1.0")
def catsStdNonEmptyParallelForZipList: NonEmptyParallel.Aux[List, ZipList] =
Expand All @@ -36,6 +38,7 @@ trait ParallelInstances extends ParallelInstances1 {
@deprecated("Use EitherT.catsDataParallelForEitherTWithParallelEffect", "2.0.0")
def catsParallelForEitherTNestedParallelValidated[M[_], E: Semigroup](
implicit P: Parallel[M]
): Parallel.Aux[EitherT[M, E, *], Nested[P.F, Validated[E, *], *]] =
): Parallel.Aux[({ type λ[α$] = EitherT[M, E, α$] })#λ,
({ type λ[α$] = Nested[P.F, ({ type λ[α$$] = Validated[E, α$$] })#λ, α$] })#λ] =
EitherT.catsDataParallelForEitherTWithParallelEffect[M, E]
}
4 changes: 2 additions & 2 deletions core/src/main/scala-2.13+/cats/instances/lazyList.scala
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,9 @@ trait LazyListInstances extends cats.kernel.instances.LazyListInstances {
def applicative: Applicative[ZipLazyList] = ZipLazyList.catsDataAlternativeForZipLazyList

def sequential: ZipLazyList ~> LazyList =
λ[ZipLazyList ~> LazyList](_.value)
new (ZipLazyList ~> LazyList) { def apply[A$](a$ : ZipLazyList[A$]): LazyList[A$] = a$.value }

def parallel: LazyList ~> ZipLazyList =
λ[LazyList ~> ZipLazyList](v => new ZipLazyList(v))
new (LazyList ~> ZipLazyList) { def apply[A$](v: LazyList[A$]): ZipLazyList[A$] = new ZipLazyList(v) }
}
}
4 changes: 2 additions & 2 deletions core/src/main/scala-2.13+/cats/instances/stream.scala
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ trait StreamInstances extends cats.kernel.instances.StreamInstances {
def applicative: Applicative[ZipStream] = ZipStream.catsDataAlternativeForZipStream

def sequential: ZipStream ~> Stream =
λ[ZipStream ~> Stream](_.value)
new (ZipStream ~> Stream) { def apply[A$](a$ : ZipStream[A$]): Stream[A$] = a$.value }

def parallel: Stream ~> ZipStream =
λ[Stream ~> ZipStream](v => new ZipStream(v))
new (Stream ~> ZipStream) { def apply[A$](v: Stream[A$]): ZipStream[A$] = new ZipStream(v) }
}
}

Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/Alternative.scala
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ import scala.annotation.implicitNotFound
def guard(condition: Boolean): F[Unit] =
if (condition) unit else empty

override def compose[G[_]: Applicative]: Alternative[λ[α => F[G[α]]]] =
override def compose[G[_]: Applicative]: Alternative[({ type λ] = F[G[α]] })#λ] =
new ComposedAlternative[F, G] {
val F = self
val G = Applicative[G]
Expand Down
8 changes: 4 additions & 4 deletions core/src/main/scala/cats/Applicative.scala
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ import scala.annotation.implicitNotFound
* res1: List[Option[(Boolean, Int)]] = List(None, None, Some((true,2)), None, Some((false,2)), None)
* }}}
*/
def compose[G[_]: Applicative]: Applicative[λ[α => F[G[α]]]] =
def compose[G[_]: Applicative]: Applicative[({ type λ] = F[G[α]] })#λ] =
new ComposedApplicative[F, G] {
val F = self
val G = Applicative[G]
Expand Down Expand Up @@ -133,7 +133,7 @@ import scala.annotation.implicitNotFound
* res2: List[Comparison] = List(LessThan, LessThan, LessThan, GreaterThan)
* }}}
*/
def composeContravariantMonoidal[G[_]: ContravariantMonoidal]: ContravariantMonoidal[λ[α => F[G[α]]]] =
def composeContravariantMonoidal[G[_]: ContravariantMonoidal]: ContravariantMonoidal[({ type λ] = F[G[α]] })#λ] =
new ComposedApplicativeContravariantMonoidal[F, G] {
val F = self
val G = ContravariantMonoidal[G]
Expand Down Expand Up @@ -208,7 +208,7 @@ object Applicative {
* res0: (Long, Int) = (3,6)
* }}}
*/
implicit def catsApplicativeForArrow[F[_, _], A](implicit F: Arrow[F]): Applicative[F[A, *]] =
implicit def catsApplicativeForArrow[F[_, _], A](implicit F: Arrow[F]): Applicative[({ type λ[α$] = F[A, α$] })#λ] =
new ArrowApplicative[F, A](F)

/**
Expand Down Expand Up @@ -274,7 +274,7 @@ private[cats] class ApplicativeMonoid[F[_], A](f: Applicative[F], monoid: Monoid
def empty: F[A] = f.pure(monoid.empty)
}

private[cats] class ArrowApplicative[F[_, _], A](F: Arrow[F]) extends Applicative[F[A, *]] {
private[cats] class ArrowApplicative[F[_, _], A](F: Arrow[F]) extends Applicative[({ type λ[α$] = F[A, α$] })#λ] {
def pure[B](b: B): F[A, B] = F.lift[A, B](_ => b)
override def map[B, C](fb: F[A, B])(f: B => C): F[A, C] = F.rmap(fb)(f)
def ap[B, C](ff: F[A, B => C])(fb: F[A, B]): F[A, C] =
Expand Down
2 changes: 1 addition & 1 deletion core/src/main/scala/cats/Apply.scala
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ trait Apply[F[_]] extends Functor[F] with InvariantSemigroupal[F] with ApplyArit
* res1: List[Option[(Boolean, Int)]] = List(None, None, Some((true,2)), None, Some((false,2)), None)
* }}}
*/
def compose[G[_]: Apply]: Apply[λ[α => F[G[α]]]] =
def compose[G[_]: Apply]: Apply[({ type λ] = F[G[α]] })#λ] =
new ComposedApply[F, G] {
val F = self
val G = Apply[G]
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala/cats/Bifoldable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import scala.annotation.implicitNotFound
(c: C, b: B) => C.combine(c, g(b))
)

def compose[G[_, _]](implicit ev: Bifoldable[G]): Bifoldable[λ[(α, β) => F[G[α, β], G[α, β]]]] =
def compose[G[_, _]](implicit ev: Bifoldable[G]): Bifoldable[({ type λ[α, β] = F[G[α, β], G[α, β]] })#λ] =
new ComposedBifoldable[F, G] {
val F = self
val G = ev
Expand Down Expand Up @@ -77,7 +77,8 @@ object Bifoldable {
}
}

private[cats] trait ComposedBifoldable[F[_, _], G[_, _]] extends Bifoldable[λ[(α, β) => F[G[α, β], G[α, β]]]] {
private[cats] trait ComposedBifoldable[F[_, _], G[_, _]]
extends Bifoldable[({ type λ[α, β] = F[G[α, β], G[α, β]] })#λ] {
implicit def F: Bifoldable[F]
implicit def G: Bifoldable[G]

Expand Down
12 changes: 6 additions & 6 deletions core/src/main/scala/cats/Bifunctor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import scala.annotation.implicitNotFound
*/
def bimap[A, B, C, D](fab: F[A, B])(f: A => C, g: B => D): F[C, D]

def rightFunctor[X]: Functor[F[X, *]] =
def rightFunctor[X]: Functor[({ type λ[α$] = F[X, α$] })#λ] =
new RightFunctor[F, X] { val F = self }

def leftFunctor[X]: Functor[F[*, X]] =
def leftFunctor[X]: Functor[({ type λ[α$] = F[α$, X] })#λ] =
new LeftFunctor[F, X] { val F = self }

// derived methods
Expand All @@ -37,7 +37,7 @@ import scala.annotation.implicitNotFound
def leftMap[A, B, C](fab: F[A, B])(f: A => C): F[C, B] = bimap(fab)(f, identity)

/** The composition of two Bifunctors is itself a Bifunctor */
def compose[G[_, _]](implicit G0: Bifunctor[G]): Bifunctor[λ[(α, β) => F[G[α, β], G[α, β]]]] =
def compose[G[_, _]](implicit G0: Bifunctor[G]): Bifunctor[({ type λ[α, β] = F[G[α, β], G[α, β]] })#λ] =
new ComposedBifunctor[F, G] {
val F = self
val G = G0
Expand Down Expand Up @@ -97,7 +97,7 @@ object Bifunctor {
}
}

private[cats] trait ComposedBifunctor[F[_, _], G[_, _]] extends Bifunctor[λ[(A, B) => F[G[A, B], G[A, B]]]] {
private[cats] trait ComposedBifunctor[F[_, _], G[_, _]] extends Bifunctor[({ type λ[A, B] = F[G[A, B], G[A, B]] })#λ] {
def F: Bifunctor[F]
def G: Bifunctor[G]

Expand All @@ -107,14 +107,14 @@ private[cats] trait ComposedBifunctor[F[_, _], G[_, _]] extends Bifunctor[λ[(A,
}
}

abstract private class LeftFunctor[F[_, _], X] extends Functor[F[*, X]] {
abstract private class LeftFunctor[F[_, _], X] extends Functor[({ type λ[α$] = F[α$, X] })#λ] {
implicit val F: Bifunctor[F]

override def map[A, C](fax: F[A, X])(f: A => C): F[C, X] =
F.bimap(fax)(f, identity)
}

abstract private class RightFunctor[F[_, _], X] extends Functor[F[X, *]] {
abstract private class RightFunctor[F[_, _], X] extends Functor[({ type λ[α$] = F[X, α$] })#λ] {
implicit val F: Bifunctor[F]

override def map[A, C](fxa: F[X, A])(f: A => C): F[X, C] =
Expand Down
4 changes: 2 additions & 2 deletions core/src/main/scala/cats/Bitraverse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ import scala.annotation.implicitNotFound
bitraverse(fab)(identity, identity)

/** If F and G are both [[cats.Bitraverse]] then so is their composition F[G[_, _], G[_, _]] */
def compose[G[_, _]](implicit ev: Bitraverse[G]): Bitraverse[λ[(α, β) => F[G[α, β], G[α, β]]]] =
def compose[G[_, _]](implicit ev: Bitraverse[G]): Bitraverse[({ type λ[α, β] = F[G[α, β], G[α, β]] })#λ] =
new ComposedBitraverse[F, G] {
val F = self
val G = ev
Expand Down Expand Up @@ -155,7 +155,7 @@ object Bitraverse {
}

private[cats] trait ComposedBitraverse[F[_, _], G[_, _]]
extends Bitraverse[λ[(α, β) => F[G[α, β], G[α, β]]]]
extends Bitraverse[({ type λ[α, β] = F[G[α, β], G[α, β]] })#λ]
with ComposedBifoldable[F, G]
with ComposedBifunctor[F, G] {
def F: Bitraverse[F]
Expand Down
Loading

0 comments on commit ef1c482

Please sign in to comment.