Skip to content

Commit 3f98b90

Browse files
authored
Merge branch 'master' into enable-coverage-and-docs
2 parents 3e4d184 + ca591fc commit 3f98b90

File tree

22 files changed

+967
-159
lines changed

22 files changed

+967
-159
lines changed

.travis.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jdk:
1111
- openjdk8
1212

1313

14-
scala_version_212: &scala_version_212 2.12.9
14+
scala_version_212: &scala_version_212 2.12.10
1515
scala_version_213: &scala_version_213 2.13.0
1616

1717
before_install:
@@ -29,12 +29,15 @@ stages:
2929
jobs:
3030
include:
3131
# it can speed up the overall build to have the longer-running jobs at the top of this list.
32-
- stage: test
32+
- &js_tests
33+
stage: test
3334
env: TEST="JS tests"
3435
# http://austinpray.com/ops/2015/09/20/change-travis-node-version.html
3536
install: rm -rf ~/.nvm && git clone https://github.com/creationix/nvm.git ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION
3637
script: sbt ++$TRAVIS_SCALA_VERSION! validateJS && sbt ++$TRAVIS_SCALA_VERSION! validateKernelJS && sbt ++$TRAVIS_SCALA_VERSION! validateFreeJS
3738
scala: *scala_version_212
39+
- <<: *js_tests
40+
scala: *scala_version_213
3841

3942
- &jvm_tests
4043
stage: test
@@ -64,7 +67,7 @@ jobs:
6467

6568
- stage: styling
6669
env: TEST="linting"
67-
script: sbt fmtCheck
70+
script: sbt +fmtCheck
6871

6972
- stage: publish snapshot
7073
script: |

build.sbt

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,15 @@ val isTravisBuild = settingKey[Boolean]("Flag indicating whether the current bui
1717
val crossScalaVersionsFromTravis = settingKey[Seq[String]]("Scala versions set in .travis.yml as scala_version_XXX")
1818
isTravisBuild in Global := sys.env.get("TRAVIS").isDefined
1919

20-
val scalatestVersion = "3.1.0-SNAP13"
21-
22-
val scalatestplusScalaCheckVersion = "1.0.0-SNAP8"
23-
2420
val scalaCheckVersion = "1.14.2"
2521

26-
val disciplineVersion = "1.0.0"
22+
val scalatestplusScalaCheckVersion = "3.1.0.0-RC2"
2723

28-
val disciplineScalatestVersion = "1.0.0-M1"
24+
val disciplineVersion = "1.0.1"
2925

30-
val kindProjectorVersion = "0.10.3"
26+
val disciplineScalatestVersion = "1.0.0-RC1"
27+
28+
val kindProjectorVersion = "0.11.0"
3129

3230
crossScalaVersionsFromTravis in Global := {
3331
val manifest = (baseDirectory in ThisBuild).value / ".travis.yml"
@@ -85,7 +83,7 @@ def macroDependencies(scalaVersion: String) =
8583
lazy val catsSettings = Seq(
8684
incOptions := incOptions.value.withLogRecompileOnMacro(false),
8785
libraryDependencies ++= Seq(
88-
compilerPlugin("org.typelevel" %% "kind-projector" % kindProjectorVersion)
86+
compilerPlugin(("org.typelevel" %% "kind-projector" % kindProjectorVersion).cross(CrossVersion.full))
8987
) ++ macroDependencies(scalaVersion.value)
9088
) ++ commonSettings ++ publishSettings ++ scoverageSettings ++ simulacrumSettings
9189

@@ -99,7 +97,7 @@ lazy val simulacrumSettings = Seq(
9997
override def transform(node: xml.Node): Seq[xml.Node] = node match {
10098
case e: xml.Elem
10199
if e.label == "dependency" &&
102-
e.child.exists(child => child.label == "groupId" && child.text == "com.github.mpilquist") &&
100+
e.child.exists(child => child.label == "groupId" && child.text == "org.typelevel") &&
103101
e.child.exists(child => child.label == "artifactId" && child.text.startsWith("simulacrum_")) =>
104102
Nil
105103
case _ => Seq(node)
@@ -157,9 +155,8 @@ lazy val disciplineDependencies = Seq(
157155

158156
lazy val testingDependencies = Seq(
159157
libraryDependencies ++= Seq(
160-
"org.scalatest" %%% "scalatest" % scalatestVersion % "test",
161-
"org.scalatestplus" %%% "scalatestplus-scalacheck" % scalatestplusScalaCheckVersion % "test",
162-
"org.typelevel" %%% "discipline-scalatest" % disciplineScalatestVersion % "test"
158+
"org.typelevel" %%% "discipline-scalatest" % disciplineScalatestVersion % "test",
159+
"org.scalatestplus" %%% "scalatestplus-scalacheck" % scalatestplusScalaCheckVersion % "test"
163160
)
164161
)
165162

@@ -560,12 +557,7 @@ lazy val tests = crossProject(JSPlatform, JVMPlatform)
560557
.settings(moduleName := "cats-tests")
561558
.settings(catsSettings)
562559
.settings(noPublishSettings)
563-
.settings(
564-
libraryDependencies ++= Seq(
565-
"org.scalatestplus" %%% "scalatestplus-scalacheck" % scalatestplusScalaCheckVersion,
566-
"org.typelevel" %%% "discipline-scalatest" % disciplineScalatestVersion
567-
)
568-
)
560+
.settings(testingDependencies)
569561
.jsSettings(commonJsSettings)
570562
.jvmSettings(commonJvmSettings)
571563
.settings(scalacOptions in Test := (scalacOptions in Test).value.filter(_ != "-Xfatal-warnings"))
@@ -578,11 +570,6 @@ lazy val testkit = crossProject(JSPlatform, JVMPlatform)
578570
.settings(moduleName := "cats-testkit")
579571
.settings(catsSettings)
580572
.settings(disciplineDependencies)
581-
.settings(
582-
libraryDependencies ++= Seq(
583-
"org.scalacheck" %%% "scalacheck" % scalaCheckVersion
584-
)
585-
)
586573
.jsSettings(commonJsSettings)
587574
.jvmSettings(commonJvmSettings)
588575
.settings(scalacOptions := scalacOptions.value.filter(_ != "-Xfatal-warnings"))
@@ -653,17 +640,17 @@ lazy val binCompatTest = project
653640
// see https://github.com/typelevel/cats/pull/3026#discussion_r321984342
654641
useCoursier := false,
655642
commonScalaVersionSettings,
656-
addCompilerPlugin("org.typelevel" %% "kind-projector" % kindProjectorVersion),
643+
addCompilerPlugin(("org.typelevel" %% "kind-projector" % kindProjectorVersion).cross(CrossVersion.full)),
657644
libraryDependencies ++= List(
658645
{
659646
if (priorTo2_13(scalaVersion.value))
660647
mimaPrevious("cats-core", scalaVersion.value, version.value).last % Provided
661648
else //We are not testing BC on Scala 2.13 yet.
662649
"org.typelevel" %% "cats-core" % "2.0.0-M4" % Provided
663-
},
664-
"org.scalatest" %%% "scalatest" % scalatestVersion % Test
650+
}
665651
)
666652
)
653+
.settings(testingDependencies)
667654
.dependsOn(core.jvm % Test)
668655

669656
// cats-js is JS-only
@@ -846,7 +833,6 @@ def priorTo2_13(scalaVersion: String): Boolean =
846833
lazy val sharedPublishSettings = Seq(
847834
releaseTagName := tagName.value,
848835
releaseVcsSign := true,
849-
useGpg := true, // bouncycastle has bugs with subkeys, so we use gpg instead
850836
publishMavenStyle := true,
851837
publishArtifact in Test := false,
852838
pomIncludeRepository := Function.const(false),

core/src/main/scala-2.12/cats/instances/ScalaVersionSpecificParallelInstances.scala

Lines changed: 13 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,70 +3,30 @@ package instances
33

44
import cats.data._
55
import cats.kernel.Semigroup
6-
import cats.syntax.either._
7-
import cats.{~>, Applicative, Apply, FlatMap, Monad, NonEmptyParallel, Parallel}
6+
import cats.{NonEmptyParallel, Parallel}
87

98
trait ParallelInstances extends ParallelInstances1 {
10-
implicit def catsParallelForEitherValidated[E: Semigroup]: Parallel.Aux[Either[E, *], Validated[E, *]] =
11-
new Parallel[Either[E, *]] {
12-
type F[x] = Validated[E, x]
139

14-
def applicative: Applicative[Validated[E, *]] = Validated.catsDataApplicativeErrorForValidated
15-
def monad: Monad[Either[E, *]] = cats.instances.either.catsStdInstancesForEither
16-
17-
def sequential: Validated[E, *] ~> Either[E, *] =
18-
λ[Validated[E, *] ~> Either[E, *]](_.toEither)
19-
20-
def parallel: Either[E, *] ~> Validated[E, *] =
21-
λ[Either[E, *] ~> Validated[E, *]](_.toValidated)
22-
}
10+
@deprecated("Use cats.instances.either.catsParallelForEitherAndValidated", "2.1.0")
11+
def catsParallelForEitherValidated[E: Semigroup]: Parallel.Aux[Either[E, *], Validated[E, *]] =
12+
cats.instances.either.catsParallelForEitherAndValidated[E]
2313

2414
@deprecated("Use OptionT.catsDataParallelForOptionT", "2.0.0")
2515
def catsParallelForOptionTNestedOption[M[_]](
2616
implicit P: Parallel[M]
2717
): Parallel.Aux[OptionT[M, *], Nested[P.F, Option, *]] = OptionT.catsDataParallelForOptionT[M]
2818

29-
implicit def catsStdNonEmptyParallelForZipList: NonEmptyParallel.Aux[List, ZipList] =
30-
new NonEmptyParallel[List] {
31-
type F[x] = ZipList[x]
32-
33-
def flatMap: FlatMap[List] = cats.instances.list.catsStdInstancesForList
34-
def apply: Apply[ZipList] = ZipList.catsDataCommutativeApplyForZipList
35-
36-
def sequential: ZipList ~> List =
37-
λ[ZipList ~> List](_.value)
38-
39-
def parallel: List ~> ZipList =
40-
λ[List ~> ZipList](v => new ZipList(v))
41-
}
42-
43-
implicit def catsStdNonEmptyParallelForZipVector: NonEmptyParallel.Aux[Vector, ZipVector] =
44-
new NonEmptyParallel[Vector] {
45-
type F[x] = ZipVector[x]
46-
47-
def flatMap: FlatMap[Vector] = cats.instances.vector.catsStdInstancesForVector
48-
def apply: Apply[ZipVector] = ZipVector.catsDataCommutativeApplyForZipVector
49-
50-
def sequential: ZipVector ~> Vector =
51-
λ[ZipVector ~> Vector](_.value)
52-
53-
def parallel: Vector ~> ZipVector =
54-
λ[Vector ~> ZipVector](v => new ZipVector(v))
55-
}
56-
57-
implicit def catsStdParallelForZipStream: Parallel.Aux[Stream, ZipStream] =
58-
new Parallel[Stream] {
59-
type F[x] = ZipStream[x]
60-
61-
def monad: Monad[Stream] = cats.instances.stream.catsStdInstancesForStream
62-
def applicative: Applicative[ZipStream] = ZipStream.catsDataAlternativeForZipStream
19+
@deprecated("Use cats.instances.list.catsStdNonEmptyParallelForListZipList", "2.1.0")
20+
def catsStdNonEmptyParallelForZipList: NonEmptyParallel.Aux[List, ZipList] =
21+
cats.instances.list.catsStdNonEmptyParallelForListZipList
6322

64-
def sequential: ZipStream ~> Stream =
65-
λ[ZipStream ~> Stream](_.value)
23+
@deprecated("Use cats.instances.vector.catsStdNonEmptyParallelForVectorZipVector", "2.1.0")
24+
def catsStdNonEmptyParallelForZipVector: NonEmptyParallel.Aux[Vector, ZipVector] =
25+
cats.instances.vector.catsStdNonEmptyParallelForVectorZipVector
6626

67-
def parallel: Stream ~> ZipStream =
68-
λ[Stream ~> ZipStream](v => new ZipStream(v))
69-
}
27+
@deprecated("Use cats.instances.stream.catsStdParallelForStreamZipStream", "2.1.0")
28+
def catsStdParallelForZipStream: Parallel.Aux[Stream, ZipStream] =
29+
cats.instances.stream.catsStdParallelForStreamZipStream
7030

7131
@deprecated("Use EitherT.catsDataParallelForEitherTWithParallelEffect", "2.0.0")
7232
def catsParallelForEitherTNestedParallelValidated[M[_], E: Semigroup](

core/src/main/scala-2.12/cats/instances/stream.scala

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cats
22
package instances
33

4+
import cats.data.ZipStream
45
import cats.syntax.show._
56

67
import scala.annotation.tailrec
@@ -157,6 +158,19 @@ trait StreamInstances extends cats.kernel.instances.StreamInstances {
157158
def show(fa: Stream[A]): String = if (fa.isEmpty) "Stream()" else s"Stream(${fa.head.show}, ?)"
158159
}
159160

161+
implicit def catsStdParallelForStreamZipStream: Parallel.Aux[Stream, ZipStream] =
162+
new Parallel[Stream] {
163+
type F[x] = ZipStream[x]
164+
165+
def monad: Monad[Stream] = cats.instances.stream.catsStdInstancesForStream
166+
def applicative: Applicative[ZipStream] = ZipStream.catsDataAlternativeForZipStream
167+
168+
def sequential: ZipStream ~> Stream =
169+
λ[ZipStream ~> Stream](_.value)
170+
171+
def parallel: Stream ~> ZipStream =
172+
λ[Stream ~> ZipStream](v => new ZipStream(v))
173+
}
160174
}
161175

162176
private[instances] trait StreamInstancesBinCompat0 {

core/src/main/scala-2.13+/cats/instances/ScalaVersionSpecificParallelInstances.scala

Lines changed: 16 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3,85 +3,35 @@ package instances
33

44
import cats.data._
55
import cats.kernel.Semigroup
6-
import cats.syntax.either._
7-
import cats.{~>, Applicative, Apply, FlatMap, Monad, NonEmptyParallel, Parallel}
6+
import cats.data.ZipLazyList
7+
import cats.{NonEmptyParallel, Parallel}
88

99
trait ParallelInstances extends ParallelInstances1 {
10-
implicit def catsParallelForEitherValidated[E: Semigroup]: Parallel.Aux[Either[E, *], Validated[E, *]] =
11-
new Parallel[Either[E, *]] {
12-
type F[x] = Validated[E, x]
1310

14-
def applicative: Applicative[Validated[E, *]] = Validated.catsDataApplicativeErrorForValidated
15-
def monad: Monad[Either[E, *]] = cats.instances.either.catsStdInstancesForEither
16-
17-
def sequential: Validated[E, *] ~> Either[E, *] =
18-
λ[Validated[E, *] ~> Either[E, *]](_.toEither)
19-
20-
def parallel: Either[E, *] ~> Validated[E, *] =
21-
λ[Either[E, *] ~> Validated[E, *]](_.toValidated)
22-
}
11+
@deprecated("Use cats.instances.either.catsParallelForEitherAndValidated", "2.1.0")
12+
def catsParallelForEitherValidated[E: Semigroup]: Parallel.Aux[Either[E, *], Validated[E, *]] =
13+
cats.instances.either.catsParallelForEitherAndValidated[E]
2314

2415
@deprecated("Use OptionT.catsDataParallelForOptionT", "2.0.0")
2516
def catsParallelForOptionTNestedOption[M[_]](
2617
implicit P: Parallel[M]
2718
): Parallel.Aux[OptionT[M, *], Nested[P.F, Option, *]] = OptionT.catsDataParallelForOptionT[M]
2819

29-
implicit def catsStdNonEmptyParallelForZipList: NonEmptyParallel.Aux[List, ZipList] =
30-
new NonEmptyParallel[List] {
31-
type F[x] = ZipList[x]
32-
33-
def flatMap: FlatMap[List] = cats.instances.list.catsStdInstancesForList
34-
def apply: Apply[ZipList] = ZipList.catsDataCommutativeApplyForZipList
35-
36-
def sequential: ZipList ~> List =
37-
λ[ZipList ~> List](_.value)
38-
39-
def parallel: List ~> ZipList =
40-
λ[List ~> ZipList](v => new ZipList(v))
41-
}
42-
43-
implicit def catsStdNonEmptyParallelForZipVector: NonEmptyParallel.Aux[Vector, ZipVector] =
44-
new NonEmptyParallel[Vector] {
45-
type F[x] = ZipVector[x]
46-
47-
def flatMap: FlatMap[Vector] = cats.instances.vector.catsStdInstancesForVector
48-
def apply: Apply[ZipVector] = ZipVector.catsDataCommutativeApplyForZipVector
20+
@deprecated("Use cats.instances.list.catsStdNonEmptyParallelForListZipList", "2.1.0")
21+
def catsStdNonEmptyParallelForZipList: NonEmptyParallel.Aux[List, ZipList] =
22+
cats.instances.list.catsStdNonEmptyParallelForListZipList
4923

50-
def sequential: ZipVector ~> Vector =
51-
λ[ZipVector ~> Vector](_.value)
52-
53-
def parallel: Vector ~> ZipVector =
54-
λ[Vector ~> ZipVector](v => new ZipVector(v))
55-
}
24+
@deprecated("Use cats.instances.vector.catsStdNonEmptyParallelForVectorZipVector", "2.1.0")
25+
def catsStdNonEmptyParallelForZipVector: NonEmptyParallel.Aux[Vector, ZipVector] =
26+
cats.instances.vector.catsStdNonEmptyParallelForVectorZipVector
5627

5728
@deprecated("Use catsStdParallelForZipLazyList", "2.0.0-RC2")
58-
implicit def catsStdParallelForZipStream: Parallel.Aux[Stream, ZipStream] =
59-
new Parallel[Stream] {
60-
type F[x] = ZipStream[x]
61-
62-
def monad: Monad[Stream] = cats.instances.stream.catsStdInstancesForStream
63-
def applicative: Applicative[ZipStream] = ZipStream.catsDataAlternativeForZipStream
64-
65-
def sequential: ZipStream ~> Stream =
66-
λ[ZipStream ~> Stream](_.value)
67-
68-
def parallel: Stream ~> ZipStream =
69-
λ[Stream ~> ZipStream](v => new ZipStream(v))
70-
}
71-
72-
implicit def catsStdParallelForZipLazyList[A]: Parallel.Aux[LazyList, ZipLazyList] =
73-
new Parallel[LazyList] {
74-
type F[x] = ZipLazyList[x]
75-
76-
def monad: Monad[LazyList] = cats.instances.lazyList.catsStdInstancesForLazyList
77-
def applicative: Applicative[ZipLazyList] = ZipLazyList.catsDataAlternativeForZipLazyList
78-
79-
def sequential: ZipLazyList ~> LazyList =
80-
λ[ZipLazyList ~> LazyList](_.value)
29+
def catsStdParallelForZipStream: Parallel.Aux[Stream, ZipStream] =
30+
cats.instances.stream.catsStdParallelForStreamZipStream
8131

82-
def parallel: LazyList ~> ZipLazyList =
83-
λ[LazyList ~> ZipLazyList](v => new ZipLazyList(v))
84-
}
32+
@deprecated("Use cats.instances.lazyList.catsStdParallelForLazyListZipLazyList", "2.1.0")
33+
def catsStdParallelForZipLazyList[A]: Parallel.Aux[LazyList, ZipLazyList] =
34+
cats.instances.lazyList.catsStdParallelForLazyListZipLazyList[A]
8535

8636
@deprecated("Use EitherT.catsDataParallelForEitherTWithParallelEffect", "2.0.0")
8737
def catsParallelForEitherTNestedParallelValidated[M[_], E: Semigroup](

core/src/main/scala-2.13+/cats/instances/lazyList.scala

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package cats
22
package instances
3+
34
import cats.kernel
45
import cats.syntax.show._
6+
import cats.data.ZipLazyList
57

68
import scala.annotation.tailrec
79

@@ -155,4 +157,18 @@ trait LazyListInstances extends cats.kernel.instances.LazyListInstances {
155157
.value
156158

157159
}
160+
161+
implicit def catsStdParallelForLazyListZipLazyList[A]: Parallel.Aux[LazyList, ZipLazyList] =
162+
new Parallel[LazyList] {
163+
type F[x] = ZipLazyList[x]
164+
165+
def monad: Monad[LazyList] = cats.instances.lazyList.catsStdInstancesForLazyList
166+
def applicative: Applicative[ZipLazyList] = ZipLazyList.catsDataAlternativeForZipLazyList
167+
168+
def sequential: ZipLazyList ~> LazyList =
169+
λ[ZipLazyList ~> LazyList](_.value)
170+
171+
def parallel: LazyList ~> ZipLazyList =
172+
λ[LazyList ~> ZipLazyList](v => new ZipLazyList(v))
173+
}
158174
}

0 commit comments

Comments
 (0)