Skip to content

Commit 75451cc

Browse files
committed
Remove simulacrum
1 parent 3cb7639 commit 75451cc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+99
-628
lines changed

.scalafix.conf

-10
This file was deleted.

DESIGN.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ ensure correctness.
77

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

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

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

4544
As the type class families grow, it's possible that additional modules
4645
will be added as well. Modules which depend on other libraries

alleycats-core/src/main/scala/alleycats/ConsK.scala

+1-10
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
package alleycats
2323

2424
import cats.SemigroupK
25-
import simulacrum.typeclass
2625

27-
@typeclass trait ConsK[F[_]] extends Serializable {
26+
trait ConsK[F[_]] extends Serializable {
2827
def cons[A](hd: A, tl: F[A]): F[A]
2928
}
3029

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

37-
/* ======================================================================== */
38-
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
39-
/* ======================================================================== */
40-
4136
/**
4237
* Summon an instance of [[ConsK]] for `F`.
4338
*/
@@ -73,8 +68,4 @@ object ConsK {
7368
@deprecated("Use cats.syntax object imports", "2.2.0")
7469
object nonInheritedOps extends ToConsKOps
7570

76-
/* ======================================================================== */
77-
/* END OF SIMULACRUM-MANAGED CODE */
78-
/* ======================================================================== */
79-
8071
}

alleycats-core/src/main/scala/alleycats/Empty.scala

+1-11
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ package alleycats
2424
import cats.{Eq, Monoid}
2525
import cats.syntax.eq._
2626

27-
import simulacrum.typeclass
28-
29-
@typeclass trait Empty[A] extends Serializable {
27+
trait Empty[A] extends Serializable {
3028
def empty: A
3129

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

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

45-
/* ======================================================================== */
46-
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
47-
/* ======================================================================== */
48-
4943
/**
5044
* Summon an instance of [[Empty]] for `A`.
5145
*/
@@ -83,10 +77,6 @@ object Empty extends EmptyInstances0 {
8377
@deprecated("Use cats.syntax object imports", "2.2.0")
8478
object nonInheritedOps extends ToEmptyOps
8579

86-
/* ======================================================================== */
87-
/* END OF SIMULACRUM-MANAGED CODE */
88-
/* ======================================================================== */
89-
9080
}
9181

9282
private[alleycats] trait EmptyInstances0 extends compat.IterableEmptyInstance with EmptyInstances1

alleycats-core/src/main/scala/alleycats/EmptyK.scala

+1-11
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@
2121

2222
package alleycats
2323

24-
import simulacrum.typeclass
25-
26-
@typeclass trait EmptyK[F[_]] extends Serializable { self =>
24+
trait EmptyK[F[_]] extends Serializable { self =>
2725
def empty[A]: F[A]
2826

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

3533
object EmptyK extends EmptyKInstances0 {
3634

37-
/* ======================================================================== */
38-
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
39-
/* ======================================================================== */
40-
4135
/**
4236
* Summon an instance of [[EmptyK]] for `F`.
4337
*/
@@ -73,10 +67,6 @@ object EmptyK extends EmptyKInstances0 {
7367
@deprecated("Use cats.syntax object imports", "2.2.0")
7468
object nonInheritedOps extends ToEmptyKOps
7569

76-
/* ======================================================================== */
77-
/* END OF SIMULACRUM-MANAGED CODE */
78-
/* ======================================================================== */
79-
8070
}
8171

8272
private[alleycats] trait EmptyKInstances0 {

alleycats-core/src/main/scala/alleycats/Extract.scala

+1-11
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ package alleycats
2323

2424
import cats.{CoflatMap, Comonad}
2525

26-
import simulacrum.typeclass
27-
28-
@typeclass trait Extract[F[_]] extends Serializable {
26+
trait Extract[F[_]] extends Serializable {
2927
def extract[A](fa: F[A]): A
3028
}
3129

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

47-
/* ======================================================================== */
48-
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
49-
/* ======================================================================== */
50-
5145
/**
5246
* Summon an instance of [[Extract]] for `F`.
5347
*/
@@ -84,8 +78,4 @@ object Extract {
8478
@deprecated("Use cats.syntax object imports", "2.2.0")
8579
object nonInheritedOps extends ToExtractOps
8680

87-
/* ======================================================================== */
88-
/* END OF SIMULACRUM-MANAGED CODE */
89-
/* ======================================================================== */
90-
9181
}

alleycats-core/src/main/scala/alleycats/One.scala

+1-10
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,8 @@ package alleycats
2323

2424
import cats.Eq
2525
import cats.syntax.eq._
26-
import simulacrum.typeclass
2726

28-
@typeclass trait One[A] extends Serializable {
27+
trait One[A] extends Serializable {
2928
def one: A
3029

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

42-
/* ======================================================================== */
43-
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
44-
/* ======================================================================== */
45-
4641
/**
4742
* Summon an instance of [[One]] for `A`.
4843
*/
@@ -80,8 +75,4 @@ object One {
8075
@deprecated("Use cats.syntax object imports", "2.2.0")
8176
object nonInheritedOps extends ToOneOps
8277

83-
/* ======================================================================== */
84-
/* END OF SIMULACRUM-MANAGED CODE */
85-
/* ======================================================================== */
86-
8778
}

alleycats-core/src/main/scala/alleycats/Pure.scala

+1-10
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@
2222
package alleycats
2323

2424
import cats.{Applicative, FlatMap, Monad}
25-
import simulacrum.typeclass
2625

27-
@typeclass trait Pure[F[_]] extends Serializable {
26+
trait Pure[F[_]] extends Serializable {
2827
def pure[A](a: A): F[A]
2928
}
3029

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

47-
/* ======================================================================== */
48-
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
49-
/* ======================================================================== */
50-
5146
/**
5247
* Summon an instance of [[Pure]] for `F`.
5348
*/
@@ -83,8 +78,4 @@ object Pure {
8378
@deprecated("Use cats.syntax object imports", "2.2.0")
8479
object nonInheritedOps extends ToPureOps
8580

86-
/* ======================================================================== */
87-
/* END OF SIMULACRUM-MANAGED CODE */
88-
/* ======================================================================== */
89-
9081
}

alleycats-core/src/main/scala/alleycats/Zero.scala

+1-11
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,7 @@ package alleycats
2424
import cats.Eq
2525
import cats.syntax.eq._
2626

27-
import simulacrum.typeclass
28-
29-
@typeclass trait Zero[A] extends Serializable {
27+
trait Zero[A] extends Serializable {
3028
def zero: A
3129

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

43-
/* ======================================================================== */
44-
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
45-
/* ======================================================================== */
46-
4741
/**
4842
* Summon an instance of [[Zero]] for `A`.
4943
*/
@@ -81,8 +75,4 @@ object Zero {
8175
@deprecated("Use cats.syntax object imports", "2.2.0")
8276
object nonInheritedOps extends ToZeroOps
8377

84-
/* ======================================================================== */
85-
/* END OF SIMULACRUM-MANAGED CODE */
86-
/* ======================================================================== */
87-
8878
}

build.sbt

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
ThisBuild / tlBaseVersion := "2.8"
22

3-
ThisBuild / scalafixDependencies += "org.typelevel" %% "simulacrum-scalafix" % "0.5.3"
4-
53
val scalaCheckVersion = "1.15.4"
64

75
val disciplineVersion = "1.4.0"
@@ -60,15 +58,6 @@ lazy val cats1BincompatSettings = Seq(
6058
}
6159
)
6260

63-
lazy val simulacrumSettings = Seq(
64-
libraryDependencies ++= (if (tlIsScala3.value) Nil else Seq(compilerPlugin(scalafixSemanticdb))),
65-
scalacOptions ++= (
66-
if (tlIsScala3.value) Nil
67-
else Seq(s"-P:semanticdb:targetroot:${baseDirectory.value}/target/.semanticdb", "-Yrangepos")
68-
),
69-
libraryDependencies += "org.typelevel" %% "simulacrum-scalafix-annotations" % "0.5.4"
70-
)
71-
7261
ThisBuild / tlVersionIntroduced := Map("3" -> "2.6.1")
7362

7463
lazy val commonJvmSettings = Seq(
@@ -176,7 +165,7 @@ lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
176165
.crossType(CrossType.Pure)
177166
.dependsOn(kernel)
178167
.settings(moduleName := "cats-core", name := "Cats core")
179-
.settings(macroSettings, simulacrumSettings)
168+
.settings(macroSettings)
180169
.settings(Compile / sourceGenerators += (Compile / sourceManaged).map(Boilerplate.gen).taskValue)
181170
.settings(
182171
libraryDependencies += "org.scalacheck" %%% "scalacheck" % scalaCheckVersion % Test,

core/src/main/scala/cats/Align.scala

+1-11
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121

2222
package cats
2323

24-
import simulacrum.typeclass
25-
2624
import cats.data.Ior
2725
import scala.collection.immutable.{Seq, SortedMap}
2826

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

3735
def functor: Functor[F]
3836

@@ -163,10 +161,6 @@ object Align extends ScalaVersionSpecificAlignInstances {
163161
)
164162
}
165163

166-
/* ======================================================================== */
167-
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
168-
/* ======================================================================== */
169-
170164
/**
171165
* Summon an instance of [[Align]] for `F`.
172166
*/
@@ -210,8 +204,4 @@ object Align extends ScalaVersionSpecificAlignInstances {
210204
@deprecated("Use cats.syntax object imports", "2.2.0")
211205
object nonInheritedOps extends ToAlignOps
212206

213-
/* ======================================================================== */
214-
/* END OF SIMULACRUM-MANAGED CODE */
215-
/* ======================================================================== */
216-
217207
}

core/src/main/scala/cats/Alternative.scala

+2-10
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@
2121

2222
package cats
2323

24-
import simulacrum.typeclass
2524
import cats.kernel.compat.scalaVersionSpecific._
2625

27-
@typeclass trait Alternative[F[_]] extends NonEmptyAlternative[F] with MonoidK[F] { self =>
26+
trait Alternative[F[_]] extends NonEmptyAlternative[F] with MonoidK[F] { self =>
2827

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

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

135-
/* ======================================================================== */
136-
/* THE FOLLOWING CODE IS MANAGED BY SIMULACRUM; PLEASE DO NOT EDIT!!!! */
137-
/* ======================================================================== */
138-
139134
/**
140135
* Summon an instance of [[Alternative]] for `F`.
141136
*/
@@ -179,7 +174,4 @@ object Alternative {
179174
@deprecated("Use cats.syntax object imports", "2.2.0")
180175
object nonInheritedOps extends ToAlternativeOps
181176

182-
/* ======================================================================== */
183-
/* END OF SIMULACRUM-MANAGED CODE */
184-
/* ======================================================================== */
185177
}

0 commit comments

Comments
 (0)