Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mark Ops traits as Serializable #3440

Merged
merged 3 commits into from
May 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions alleycats-core/src/main/scala/alleycats/ConsK.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ object ConsK {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[ConsK]] for `F`.
*/
@inline def apply[F[_]](implicit instance: ConsK[F]): ConsK[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: ConsK[F]
def self: F[A]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToConsKOps {
trait ToConsKOps extends Serializable {
implicit def toConsKOps[F[_], A](target: F[A])(implicit tc: ConsK[F]): Ops[F, A] {
type TypeClassType = ConsK[F]
} =
Expand Down
5 changes: 3 additions & 2 deletions alleycats-core/src/main/scala/alleycats/Empty.scala
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,21 @@ object Empty extends EmptyInstances0 {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Empty]] for `A`.
*/
@inline def apply[A](implicit instance: Empty[A]): Empty[A] = instance

trait Ops[A] {
trait Ops[A] extends Serializable {
type TypeClassType <: Empty[A]
def self: A
val typeClassInstance: TypeClassType
def isEmpty(implicit ev: Eq[A]): Boolean = typeClassInstance.isEmpty(self)(ev)
def nonEmpty(implicit ev: Eq[A]): Boolean = typeClassInstance.nonEmpty(self)(ev)
}
trait AllOps[A] extends Ops[A]
trait ToEmptyOps {
trait ToEmptyOps extends Serializable {
implicit def toEmptyOps[A](target: A)(implicit tc: Empty[A]): Ops[A] {
type TypeClassType = Empty[A]
} =
Expand Down
5 changes: 3 additions & 2 deletions alleycats-core/src/main/scala/alleycats/EmptyK.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,19 @@ object EmptyK {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[EmptyK]] for `F`.
*/
@inline def apply[F[_]](implicit instance: EmptyK[F]): EmptyK[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: EmptyK[F]
def self: F[A]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToEmptyKOps {
trait ToEmptyKOps extends Serializable {
implicit def toEmptyKOps[F[_], A](target: F[A])(implicit tc: EmptyK[F]): Ops[F, A] {
type TypeClassType = EmptyK[F]
} =
Expand Down
5 changes: 3 additions & 2 deletions alleycats-core/src/main/scala/alleycats/Extract.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,20 @@ object Extract {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Extract]] for `F`.
*/
@inline def apply[F[_]](implicit instance: Extract[F]): Extract[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: Extract[F]
def self: F[A]
val typeClassInstance: TypeClassType
def extract: A = typeClassInstance.extract[A](self)
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToExtractOps {
trait ToExtractOps extends Serializable {
implicit def toExtractOps[F[_], A](target: F[A])(implicit tc: Extract[F]): Ops[F, A] {
type TypeClassType = Extract[F]
} =
Expand Down
5 changes: 3 additions & 2 deletions alleycats-core/src/main/scala/alleycats/One.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,21 @@ object One {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[One]] for `A`.
*/
@inline def apply[A](implicit instance: One[A]): One[A] = instance

trait Ops[A] {
trait Ops[A] extends Serializable {
type TypeClassType <: One[A]
def self: A
val typeClassInstance: TypeClassType
def isOne(implicit ev: Eq[A]): Boolean = typeClassInstance.isOne(self)(ev)
def nonOne(implicit ev: Eq[A]): Boolean = typeClassInstance.nonOne(self)(ev)
}
trait AllOps[A] extends Ops[A]
trait ToOneOps {
trait ToOneOps extends Serializable {
implicit def toOneOps[A](target: A)(implicit tc: One[A]): Ops[A] {
type TypeClassType = One[A]
} =
Expand Down
5 changes: 3 additions & 2 deletions alleycats-core/src/main/scala/alleycats/Pure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,19 @@ object Pure {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Pure]] for `F`.
*/
@inline def apply[F[_]](implicit instance: Pure[F]): Pure[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: Pure[F]
def self: F[A]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToPureOps {
trait ToPureOps extends Serializable {
implicit def toPureOps[F[_], A](target: F[A])(implicit tc: Pure[F]): Ops[F, A] {
type TypeClassType = Pure[F]
} =
Expand Down
5 changes: 3 additions & 2 deletions alleycats-core/src/main/scala/alleycats/Zero.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@ object Zero {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Zero]] for `A`.
*/
@inline def apply[A](implicit instance: Zero[A]): Zero[A] = instance

trait Ops[A] {
trait Ops[A] extends Serializable {
type TypeClassType <: Zero[A]
def self: A
val typeClassInstance: TypeClassType
def isZero(implicit ev: Eq[A]): Boolean = typeClassInstance.isZero(self)(ev)
def nonZero(implicit ev: Eq[A]): Boolean = typeClassInstance.nonZero(self)(ev)
}
trait AllOps[A] extends Ops[A]
trait ToZeroOps {
trait ToZeroOps extends Serializable {
implicit def toZeroOps[A](target: A)(implicit tc: Zero[A]): Ops[A] {
type TypeClassType = Zero[A]
} =
Expand Down
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ lazy val scoverageSettings = Seq(
)

organization in ThisBuild := "org.typelevel"
scalafixDependencies in ThisBuild += "org.typelevel" %% "simulacrum-scalafix" % "0.2.0"
scalafixDependencies in ThisBuild += "org.typelevel" %% "simulacrum-scalafix" % "0.3.0"

val isTravisBuild = settingKey[Boolean]("Flag indicating whether the current build is running under Travis")
val crossScalaVersionsFromTravis = settingKey[Seq[String]]("Scala versions set in .travis.yml as scala_version_XXX")
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala/cats/Align.scala
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ object Align extends ScalaVersionSpecificAlignInstances {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Align]] for `F`.
*/
@inline def apply[F[_]](implicit instance: Align[F]): Align[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: Align[F]
def self: F[A]
val typeClassInstance: TypeClassType
Expand All @@ -151,7 +152,7 @@ object Align extends ScalaVersionSpecificAlignInstances {
def zipAll[B](fb: F[B], a: A, b: B): F[(A, B)] = typeClassInstance.zipAll[A, B](self, fb, a, b)
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToAlignOps {
trait ToAlignOps extends Serializable {
implicit def toAlignOps[F[_], A](target: F[A])(implicit tc: Align[F]): Ops[F, A] {
type TypeClassType = Align[F]
} =
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala/cats/Alternative.scala
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ object Alternative {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Alternative]] for `F`.
*/
@inline def apply[F[_]](implicit instance: Alternative[F]): Alternative[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: Alternative[F]
def self: F[A]
val typeClassInstance: TypeClassType
Expand All @@ -114,7 +115,7 @@ object Alternative {
trait AllOps[F[_], A] extends Ops[F, A] with Applicative.AllOps[F, A] with MonoidK.AllOps[F, A] {
type TypeClassType <: Alternative[F]
}
trait ToAlternativeOps {
trait ToAlternativeOps extends Serializable {
implicit def toAlternativeOps[F[_], A](target: F[A])(implicit tc: Alternative[F]): Ops[F, A] {
type TypeClassType = Alternative[F]
} =
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala/cats/Applicative.scala
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,21 @@ object Applicative {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Applicative]] for `F`.
*/
@inline def apply[F[_]](implicit instance: Applicative[F]): Applicative[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: Applicative[F]
def self: F[A]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_], A] extends Ops[F, A] with Apply.AllOps[F, A] with InvariantMonoidal.AllOps[F, A] {
type TypeClassType <: Applicative[F]
}
trait ToApplicativeOps {
trait ToApplicativeOps extends Serializable {
implicit def toApplicativeOps[F[_], A](target: F[A])(implicit tc: Applicative[F]): Ops[F, A] {
type TypeClassType = Applicative[F]
} =
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala/cats/Apply.scala
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,13 @@ object Apply {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Apply]] for `F`.
*/
@inline def apply[F[_]](implicit instance: Apply[F]): Apply[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: Apply[F]
def self: F[A]
val typeClassInstance: TypeClassType
Expand All @@ -295,7 +296,7 @@ object Apply {
trait AllOps[F[_], A] extends Ops[F, A] with Functor.AllOps[F, A] with InvariantSemigroupal.AllOps[F, A] {
type TypeClassType <: Apply[F]
}
trait ToApplyOps {
trait ToApplyOps extends Serializable {
implicit def toApplyOps[F[_], A](target: F[A])(implicit tc: Apply[F]): Ops[F, A] {
type TypeClassType = Apply[F]
} =
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 @@ -41,12 +41,13 @@ object Bifoldable {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Bifoldable]] for `F`.
*/
@inline def apply[F[_, _]](implicit instance: Bifoldable[F]): Bifoldable[F] = instance

trait Ops[F[_, _], A, B] {
trait Ops[F[_, _], A, B] extends Serializable {
type TypeClassType <: Bifoldable[F]
def self: F[A, B]
val typeClassInstance: TypeClassType
Expand All @@ -58,7 +59,7 @@ object Bifoldable {
def bifold(implicit A: Monoid[A], B: Monoid[B]): (A, B) = typeClassInstance.bifold[A, B](self)(A, B)
}
trait AllOps[F[_, _], A, B] extends Ops[F, A, B]
trait ToBifoldableOps {
trait ToBifoldableOps extends Serializable {
implicit def toBifoldableOps[F[_, _], A, B](target: F[A, B])(implicit tc: Bifoldable[F]): Ops[F, A, B] {
type TypeClassType = Bifoldable[F]
} =
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala/cats/Bifunctor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,13 @@ object Bifunctor {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Bifunctor]] for `F`.
*/
@inline def apply[F[_, _]](implicit instance: Bifunctor[F]): Bifunctor[F] = instance

trait Ops[F[_, _], A, B] {
trait Ops[F[_, _], A, B] extends Serializable {
type TypeClassType <: Bifunctor[F]
def self: F[A, B]
val typeClassInstance: TypeClassType
Expand All @@ -78,7 +79,7 @@ object Bifunctor {
def leftWiden[C >: A]: F[C, B] = typeClassInstance.leftWiden[A, B, C](self)
}
trait AllOps[F[_, _], A, B] extends Ops[F, A, B]
trait ToBifunctorOps {
trait ToBifunctorOps extends Serializable {
implicit def toBifunctorOps[F[_, _], A, B](target: F[A, B])(implicit tc: Bifunctor[F]): Ops[F, A, B] {
type TypeClassType = Bifunctor[F]
} =
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala/cats/Bimonad.scala
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,21 @@ object Bimonad {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Bimonad]] for `F`.
*/
@inline def apply[F[_]](implicit instance: Bimonad[F]): Bimonad[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: Bimonad[F]
def self: F[A]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_], A] extends Ops[F, A] with Monad.AllOps[F, A] with Comonad.AllOps[F, A] {
type TypeClassType <: Bimonad[F]
}
trait ToBimonadOps {
trait ToBimonadOps extends Serializable {
implicit def toBimonadOps[F[_], A](target: F[A])(implicit tc: Bimonad[F]): Ops[F, A] {
type TypeClassType = Bimonad[F]
} =
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala/cats/Bitraverse.scala
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,13 @@ object Bitraverse {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[Bitraverse]] for `F`.
*/
@inline def apply[F[_, _]](implicit instance: Bitraverse[F]): Bitraverse[F] = instance

trait Ops[F[_, _], A, B] {
trait Ops[F[_, _], A, B] extends Serializable {
type TypeClassType <: Bitraverse[F]
def self: F[A, B]
val typeClassInstance: TypeClassType
Expand All @@ -133,7 +134,7 @@ object Bitraverse {
trait AllOps[F[_, _], A, B] extends Ops[F, A, B] with Bifoldable.AllOps[F, A, B] with Bifunctor.AllOps[F, A, B] {
type TypeClassType <: Bitraverse[F]
}
trait ToBitraverseOps {
trait ToBitraverseOps extends Serializable {
implicit def toBitraverseOps[F[_, _], A, B](target: F[A, B])(implicit tc: Bitraverse[F]): Ops[F, A, B] {
type TypeClassType = Bitraverse[F]
} =
Expand Down
5 changes: 3 additions & 2 deletions core/src/main/scala/cats/CoflatMap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,13 @@ object CoflatMap {
/****************************************************************************/
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/****************************************************************************/

/**
* Summon an instance of [[CoflatMap]] for `F`.
*/
@inline def apply[F[_]](implicit instance: CoflatMap[F]): CoflatMap[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: CoflatMap[F]
def self: F[A]
val typeClassInstance: TypeClassType
Expand All @@ -68,7 +69,7 @@ object CoflatMap {
trait AllOps[F[_], A] extends Ops[F, A] with Functor.AllOps[F, A] {
type TypeClassType <: CoflatMap[F]
}
trait ToCoflatMapOps {
trait ToCoflatMapOps extends Serializable {
implicit def toCoflatMapOps[F[_], A](target: F[A])(implicit tc: CoflatMap[F]): Ops[F, A] {
type TypeClassType = CoflatMap[F]
} =
Expand Down
Loading