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

Remove simulacrum #4210

Merged
merged 1 commit into from
May 23, 2022
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
10 changes: 0 additions & 10 deletions .scalafix.conf

This file was deleted.

5 changes: 2 additions & 3 deletions DESIGN.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ ensure correctness.

Cats will be designed to use modern *best practices*:

* [simulacrum](https://github.com/typelevel/simulacrum) for minimizing type class boilerplate
* [machinist](https://github.com/typelevel/machinist) for optimizing implicit operators
* [scalacheck](http://scalacheck.org) for property-based testing
* [discipline](https://github.com/typelevel/discipline) for encoding and testing laws
Expand Down Expand Up @@ -36,11 +35,11 @@ Cats provides the following modules:

* `core`: Definitions for widely-used type classes and data types.
* `laws`: The encoded laws for type classes defined in `core`, exported to assist third-party testing.
* `kernel`: Definitions for the basic algebraic type classes
* `kernel`: Definitions for the basic algebraic type classes
* `kernel-laws`: The encoded laws for type classes defined in `kernel`, exported to assist third-party testing.
* `free`: Free structures such as the free monad, and supporting type classes.
* `tests`: Verifies the laws, and runs any other tests. Not published.
* `bench`: Benchmarking suites. Not published.
* `bench`: Benchmarking suites. Not published.

As the type class families grow, it's possible that additional modules
will be added as well. Modules which depend on other libraries
Expand Down
11 changes: 1 addition & 10 deletions alleycats-core/src/main/scala/alleycats/ConsK.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
package alleycats

import cats.SemigroupK
import simulacrum.typeclass

@typeclass trait ConsK[F[_]] extends Serializable {
trait ConsK[F[_]] extends Serializable {
def cons[A](hd: A, tl: F[A]): F[A]
}

Expand All @@ -34,10 +33,6 @@ object ConsK {
def cons[A](hd: A, tl: F[A]): F[A] = s.combineK(p.pure(hd), tl)
}

/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/* ======================================================================== */

/**
* Summon an instance of [[ConsK]] for `F`.
*/
Expand Down Expand Up @@ -73,8 +68,4 @@ object ConsK {
@deprecated("Use cats.syntax object imports", "2.2.0")
object nonInheritedOps extends ToConsKOps

/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/* ======================================================================== */

}
12 changes: 1 addition & 11 deletions alleycats-core/src/main/scala/alleycats/Empty.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ package alleycats
import cats.{Eq, Monoid}
import cats.syntax.eq._

import simulacrum.typeclass

@typeclass trait Empty[A] extends Serializable {
trait Empty[A] extends Serializable {
def empty: A

def isEmpty(a: A)(implicit ev: Eq[A]): Boolean =
Expand All @@ -42,10 +40,6 @@ object Empty extends EmptyInstances0 {

def fromEmptyK[F[_], T](implicit ekf: EmptyK[F]): Empty[F[T]] = ekf.synthesize[T]

/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/* ======================================================================== */

/**
* Summon an instance of [[Empty]] for `A`.
*/
Expand Down Expand Up @@ -83,10 +77,6 @@ object Empty extends EmptyInstances0 {
@deprecated("Use cats.syntax object imports", "2.2.0")
object nonInheritedOps extends ToEmptyOps

/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/* ======================================================================== */

}

private[alleycats] trait EmptyInstances0 extends compat.IterableEmptyInstance with EmptyInstances1
Expand Down
12 changes: 1 addition & 11 deletions alleycats-core/src/main/scala/alleycats/EmptyK.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@

package alleycats

import simulacrum.typeclass

@typeclass trait EmptyK[F[_]] extends Serializable { self =>
trait EmptyK[F[_]] extends Serializable { self =>
def empty[A]: F[A]

def synthesize[A]: Empty[F[A]] =
Expand All @@ -34,10 +32,6 @@ import simulacrum.typeclass

object EmptyK extends EmptyKInstances0 {

/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/* ======================================================================== */

/**
* Summon an instance of [[EmptyK]] for `F`.
*/
Expand Down Expand Up @@ -73,10 +67,6 @@ object EmptyK extends EmptyKInstances0 {
@deprecated("Use cats.syntax object imports", "2.2.0")
object nonInheritedOps extends ToEmptyKOps

/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/* ======================================================================== */

}

private[alleycats] trait EmptyKInstances0 {
Expand Down
12 changes: 1 addition & 11 deletions alleycats-core/src/main/scala/alleycats/Extract.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ package alleycats

import cats.{CoflatMap, Comonad}

import simulacrum.typeclass

@typeclass trait Extract[F[_]] extends Serializable {
trait Extract[F[_]] extends Serializable {
def extract[A](fa: F[A]): A
}

Expand All @@ -44,10 +42,6 @@ object Extract {
def coflatMap[A, B](fa: F[A])(f: F[A] => B): F[B] = cf.coflatMap(fa)(f)
}

/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/* ======================================================================== */

/**
* Summon an instance of [[Extract]] for `F`.
*/
Expand Down Expand Up @@ -84,8 +78,4 @@ object Extract {
@deprecated("Use cats.syntax object imports", "2.2.0")
object nonInheritedOps extends ToExtractOps

/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/* ======================================================================== */

}
11 changes: 1 addition & 10 deletions alleycats-core/src/main/scala/alleycats/One.scala
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,8 @@ package alleycats

import cats.Eq
import cats.syntax.eq._
import simulacrum.typeclass

@typeclass trait One[A] extends Serializable {
trait One[A] extends Serializable {
def one: A

def isOne(a: A)(implicit ev: Eq[A]): Boolean =
Expand All @@ -39,10 +38,6 @@ object One {
def apply[A](a: => A): One[A] =
new One[A] { lazy val one: A = a }

/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/* ======================================================================== */

/**
* Summon an instance of [[One]] for `A`.
*/
Expand Down Expand Up @@ -80,8 +75,4 @@ object One {
@deprecated("Use cats.syntax object imports", "2.2.0")
object nonInheritedOps extends ToOneOps

/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/* ======================================================================== */

}
11 changes: 1 addition & 10 deletions alleycats-core/src/main/scala/alleycats/Pure.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@
package alleycats

import cats.{Applicative, FlatMap, Monad}
import simulacrum.typeclass

@typeclass trait Pure[F[_]] extends Serializable {
trait Pure[F[_]] extends Serializable {
def pure[A](a: A): F[A]
}

Expand All @@ -44,10 +43,6 @@ object Pure {
def tailRecM[A, B](a: A)(f: (A) => F[Either[A, B]]): F[B] = fm.tailRecM(a)(f)
}

/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/* ======================================================================== */

/**
* Summon an instance of [[Pure]] for `F`.
*/
Expand Down Expand Up @@ -83,8 +78,4 @@ object Pure {
@deprecated("Use cats.syntax object imports", "2.2.0")
object nonInheritedOps extends ToPureOps

/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/* ======================================================================== */

}
12 changes: 1 addition & 11 deletions alleycats-core/src/main/scala/alleycats/Zero.scala
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ package alleycats
import cats.Eq
import cats.syntax.eq._

import simulacrum.typeclass

@typeclass trait Zero[A] extends Serializable {
trait Zero[A] extends Serializable {
def zero: A

def isZero(a: A)(implicit ev: Eq[A]): Boolean =
Expand All @@ -40,10 +38,6 @@ object Zero {
def apply[A](a: => A): Zero[A] =
new Zero[A] { lazy val zero: A = a }

/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/* ======================================================================== */

/**
* Summon an instance of [[Zero]] for `A`.
*/
Expand Down Expand Up @@ -81,8 +75,4 @@ object Zero {
@deprecated("Use cats.syntax object imports", "2.2.0")
object nonInheritedOps extends ToZeroOps

/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/* ======================================================================== */

}
13 changes: 1 addition & 12 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
ThisBuild / tlBaseVersion := "2.8"

ThisBuild / scalafixDependencies += "org.typelevel" %% "simulacrum-scalafix" % "0.5.3"

val scalaCheckVersion = "1.15.4"

val disciplineVersion = "1.4.0"
Expand Down Expand Up @@ -60,15 +58,6 @@ lazy val cats1BincompatSettings = Seq(
}
)

lazy val simulacrumSettings = Seq(
libraryDependencies ++= (if (tlIsScala3.value) Nil else Seq(compilerPlugin(scalafixSemanticdb))),
scalacOptions ++= (
if (tlIsScala3.value) Nil
else Seq(s"-P:semanticdb:targetroot:${baseDirectory.value}/target/.semanticdb", "-Yrangepos")
),
libraryDependencies += "org.typelevel" %% "simulacrum-scalafix-annotations" % "0.5.4"
)

ThisBuild / tlVersionIntroduced := Map("3" -> "2.6.1")

lazy val commonJvmSettings = Seq(
Expand Down Expand Up @@ -176,7 +165,7 @@ lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Pure)
.dependsOn(kernel)
.settings(moduleName := "cats-core", name := "Cats core")
.settings(macroSettings, simulacrumSettings)
.settings(macroSettings)
.settings(Compile / sourceGenerators += (Compile / sourceManaged).map(Boilerplate.gen).taskValue)
.settings(
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion % Test,
Expand Down
12 changes: 1 addition & 11 deletions core/src/main/scala/cats/Align.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

package cats

import simulacrum.typeclass

import cats.data.Ior
import scala.collection.immutable.{Seq, SortedMap}

Expand All @@ -32,7 +30,7 @@ import scala.collection.immutable.{Seq, SortedMap}
*
* Must obey the laws in cats.laws.AlignLaws
*/
@typeclass trait Align[F[_]] extends Serializable {
trait Align[F[_]] extends Serializable {

def functor: Functor[F]

Expand Down Expand Up @@ -163,10 +161,6 @@ object Align extends ScalaVersionSpecificAlignInstances {
)
}

/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/* ======================================================================== */

/**
* Summon an instance of [[Align]] for `F`.
*/
Expand Down Expand Up @@ -210,8 +204,4 @@ object Align extends ScalaVersionSpecificAlignInstances {
@deprecated("Use cats.syntax object imports", "2.2.0")
object nonInheritedOps extends ToAlignOps

/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/* ======================================================================== */

}
12 changes: 2 additions & 10 deletions core/src/main/scala/cats/Alternative.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@

package cats

import simulacrum.typeclass
import cats.kernel.compat.scalaVersionSpecific._

@typeclass trait Alternative[F[_]] extends NonEmptyAlternative[F] with MonoidK[F] { self =>
trait Alternative[F[_]] extends NonEmptyAlternative[F] with MonoidK[F] { self =>

// Note: `protected` is only necessary to enforce binary compatibility
// since neither `private` nor `private[cats]` work properly here.
Expand Down Expand Up @@ -79,7 +78,7 @@ import cats.kernel.compat.scalaVersionSpecific._

/**
* Separate the inner foldable values into the "lefts" and "rights".
*
*
* A variant of [[[separate[G[_,_],A,B](fgab:F[G[A,B]])(implicitFM:cats\.FlatMap[F]* separate]]]
* that is specialized for Fs that have Foldable instances which allows for a single-pass implementation
* (as opposed to {{{separate}}} which is 2-pass).
Expand Down Expand Up @@ -132,10 +131,6 @@ import cats.kernel.compat.scalaVersionSpecific._
@suppressUnusedImportWarningForScalaVersionSpecific
object Alternative {

/* ======================================================================== */
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
/* ======================================================================== */

/**
* Summon an instance of [[Alternative]] for `F`.
*/
Expand Down Expand Up @@ -179,7 +174,4 @@ object Alternative {
@deprecated("Use cats.syntax object imports", "2.2.0")
object nonInheritedOps extends ToAlternativeOps

/* ======================================================================== */
/* END OF SIMULACRUM-MANAGED CODE */
/* ======================================================================== */
}
Loading