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 #29

Merged
merged 1 commit into from
May 29, 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
8 changes: 4 additions & 4 deletions output/src/main/scala/fix/AddSummoner.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ object MissingCompanionAndSummoner {
*/
@inline def apply[F[_]](implicit instance: MissingCompanionAndSummoner[F]): MissingCompanionAndSummoner[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: MissingCompanionAndSummoner[F]
def self: F[A]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToMissingCompanionAndSummonerOps {
trait ToMissingCompanionAndSummonerOps extends Serializable {
implicit def toMissingCompanionAndSummonerOps[F[_], A](target: F[A])(implicit tc: MissingCompanionAndSummoner[F]): Ops[F, A] {
type TypeClassType = MissingCompanionAndSummoner[F]
} = new Ops[F, A] {
Expand Down Expand Up @@ -67,13 +67,13 @@ object MissingSummoner {
*/
@inline def apply[F[_]](implicit instance: MissingSummoner[F]): MissingSummoner[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: MissingSummoner[F]
def self: F[A]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToMissingSummonerOps {
trait ToMissingSummonerOps extends Serializable {
implicit def toMissingSummonerOps[F[_], A](target: F[A])(implicit tc: MissingSummoner[F]): Ops[F, A] {
type TypeClassType = MissingSummoner[F]
} = new Ops[F, A] {
Expand Down
4 changes: 2 additions & 2 deletions output/src/main/scala/fix/Alternative.scala
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ object Alternative extends AlternativeFunctions {
*/
@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
def unite[G[_], B](implicit ev$1: A <:< G[B], FM: Monad[F], G: Bifoldable[G]): F[B] = typeClassInstance.unite[G, B](self.asInstanceOf[F[G[B]]])(FM, G)
}
trait AllOps[F[_], A] extends Ops[F, A]
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]
} = new Ops[F, A] {
Expand Down
10 changes: 5 additions & 5 deletions output/src/main/scala/fix/Apply.scala
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ object Apply {
*/
@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 @@ -60,7 +60,7 @@ object Apply {
trait AllOps[F[_], A] extends Ops[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]
} = new Ops[F, A] {
Expand Down Expand Up @@ -121,7 +121,7 @@ object FlatMap {
*/
@inline def apply[F[_]](implicit instance: FlatMap[F]): FlatMap[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: FlatMap[F]
def self: F[A]
val typeClassInstance: TypeClassType
Expand All @@ -131,7 +131,7 @@ object FlatMap {
trait AllOps[F[_], A] extends Ops[F, A] with Apply.AllOps[F, A] {
type TypeClassType <: FlatMap[F]
}
trait ToFlatMapOps {
trait ToFlatMapOps extends Serializable {
implicit def toFlatMapOps[F[_], A](target: F[A])(implicit tc: FlatMap[F]): Ops[F, A] {
type TypeClassType = FlatMap[F]
} = new Ops[F, A] {
Expand Down Expand Up @@ -159,4 +159,4 @@ object FlatMap {

trait ApplyArityFunctions[F[_]] {
def bad[A, B](f: F[A]): B
}
}
12 changes: 6 additions & 6 deletions output/src/main/scala/fix/Compose.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ object Compose {
*/
@inline def apply[F[_, _]](implicit instance: Compose[F]): Compose[F] = instance

trait Ops[F[_, _], A, B] {
trait Ops[F[_, _], A, B] extends Serializable {
type TypeClassType <: Compose[F]
def self: F[A, B]
val typeClassInstance: TypeClassType
Expand All @@ -46,7 +46,7 @@ object Compose {
def >>>[C](g: F[B, C]): F[A, C] = typeClassInstance.andThen[A, B, C](self, g)
}
trait AllOps[F[_, _], A, B] extends Ops[F, A, B]
trait ToComposeOps {
trait ToComposeOps extends Serializable {
implicit def toComposeOps[F[_, _], A, B](target: F[A, B])(implicit tc: Compose[F]): Ops[F, A, B] {
type TypeClassType = Compose[F]
} = new Ops[F, A, B] {
Expand Down Expand Up @@ -86,15 +86,15 @@ object Category {
*/
@inline def apply[F[_, _]](implicit instance: Category[F]): Category[F] = instance

trait Ops[F[_, _], A, B] {
trait Ops[F[_, _], A, B] extends Serializable {
type TypeClassType <: Category[F]
def self: F[A, B]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_, _], A, B] extends Ops[F, A, B] with Compose.AllOps[F, A, B] {
type TypeClassType <: Category[F]
}
trait ToCategoryOps {
trait ToCategoryOps extends Serializable {
implicit def toCategoryOps[F[_, _], A, B](target: F[A, B])(implicit tc: Category[F]): Ops[F, A, B] {
type TypeClassType = Category[F]
} = new Ops[F, A, B] {
Expand Down Expand Up @@ -168,7 +168,7 @@ object Profunctor {
*/
@inline def apply[F[_, _]](implicit instance: Profunctor[F]): Profunctor[F] = instance

trait Ops[F[_, _], A, B] {
trait Ops[F[_, _], A, B] extends Serializable {
type TypeClassType <: Profunctor[F]
def self: F[A, B]
val typeClassInstance: TypeClassType
Expand All @@ -177,7 +177,7 @@ object Profunctor {
@inline final def rmap[C](f: B => C): F[A, C] = typeClassInstance.rmap[A, B, C](self)(f)
}
trait AllOps[F[_, _], A, B] extends Ops[F, A, B]
trait ToProfunctorOps {
trait ToProfunctorOps extends Serializable {
implicit def toProfunctorOps[F[_, _], A, B](target: F[A, B])(implicit tc: Profunctor[F]): Ops[F, A, B] {
type TypeClassType = Profunctor[F]
} = new Ops[F, A, B] {
Expand Down
12 changes: 6 additions & 6 deletions output/src/main/scala/fix/Invariant.scala
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ object Invariant {
*/
@inline def apply[F[_]](implicit instance: Invariant[F]): Invariant[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: Invariant[F]
def self: F[A]
val typeClassInstance: TypeClassType
def imap[B](f: A => B)(g: B => A): F[B] = typeClassInstance.imap[A, B](self)(f)(g)
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToInvariantOps {
trait ToInvariantOps extends Serializable {
implicit def toInvariantOps[F[_], A](target: F[A])(implicit tc: Invariant[F]): Ops[F, A] {
type TypeClassType = Invariant[F]
} = new Ops[F, A] {
Expand Down Expand Up @@ -87,7 +87,7 @@ object InvariantSemigroupal {
*/
@inline def apply[F[_]](implicit instance: InvariantSemigroupal[F]): InvariantSemigroupal[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: InvariantSemigroupal[F]
def self: F[A]
val typeClassInstance: TypeClassType
Expand All @@ -96,7 +96,7 @@ object InvariantSemigroupal {
trait AllOps[F[_], A] extends Ops[F, A] with Invariant.AllOps[F, A] {
type TypeClassType <: InvariantSemigroupal[F]
}
trait ToInvariantSemigroupalOps {
trait ToInvariantSemigroupalOps extends Serializable {
implicit def toInvariantSemigroupalOps[F[_], A](target: F[A])(implicit tc: InvariantSemigroupal[F]): Ops[F, A] {
type TypeClassType = InvariantSemigroupal[F]
} = new Ops[F, A] {
Expand Down Expand Up @@ -137,13 +137,13 @@ object ContravariantSemigroupal {
*/
@inline def apply[F[_]](implicit instance: ContravariantSemigroupal[F]): ContravariantSemigroupal[F] = instance

trait Ops[F[_], A] {
trait Ops[F[_], A] extends Serializable {
type TypeClassType <: ContravariantSemigroupal[F]
def self: F[A]
val typeClassInstance: TypeClassType
}
trait AllOps[F[_], A] extends Ops[F, A]
trait ToContravariantSemigroupalOps {
trait ToContravariantSemigroupalOps extends Serializable {
implicit def toContravariantSemigroupalOps[F[_], A](target: F[A])(implicit tc: ContravariantSemigroupal[F]): Ops[F, A] {
type TypeClassType = ContravariantSemigroupal[F]
} = new Ops[F, A] {
Expand Down
6 changes: 3 additions & 3 deletions output/src/main/scala/fix/One.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,14 @@ object One {
*/
@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)
}
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]
} = new Ops[A] {
Expand All @@ -55,4 +55,4 @@ object One {
/* END OF SIMULACRUM-MANAGED CODE */
/****************************************************************************/

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -248,13 +248,13 @@ class TypeClassSupport extends SyntacticRule("TypeClassSupport") {
| */
| @inline def apply[$TypeParamDecl](implicit instance: $InstanceType): $InstanceType = instance
|
| trait Ops[$TypeParamsDecl] {
| trait Ops[$TypeParamsDecl] extends Serializable {
| type TypeClassType <: $InstanceType
| def self: $ValueType
| val typeClassInstance: TypeClassType$Methods
| }
| trait AllOps[$TypeParamsDecl] extends Ops[$TypeParamsArgs]$AllOpsParents$AllOpsBody
| trait To${Name}Ops {
| trait To${Name}Ops extends Serializable {
| implicit def to${Name}Ops[$TypeParamsDecl](target: $ValueType)(implicit tc: $InstanceType): Ops[$TypeParamsArgs] {
| type TypeClassType = $InstanceType
| } = new Ops[$TypeParamsArgs] {
Expand Down