Skip to content

Commit

Permalink
Don't use scalaVersionSpecific helpers in version-specific code
Browse files Browse the repository at this point in the history
  • Loading branch information
travisbrown committed Aug 20, 2019
1 parent 67dc634 commit 40333b2
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
package cats
package data

import kernel.compat.scalaVersionSpecific._

abstract private[data] class ScalaVersionSpecificPackage {
type NonEmptyStream[A] = OneAnd[Stream, A]

def NonEmptyStream[A](head: A, tail: Stream[A] = Stream.empty): NonEmptyStream[A] =
OneAnd(head, tail)

@suppressUnusedImportWarningForScalaVersionSpecific
def NonEmptyStream[A](head: A, tail: A*): NonEmptyStream[A] =
OneAnd(head, tail.toStream)
}
5 changes: 1 addition & 4 deletions core/src/main/scala-2.12-/cats/data/ZipStream.scala
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
package cats
package data

import kernel.compat.scalaVersionSpecific._

class ZipStream[A](val value: Stream[A]) extends AnyVal

@suppressUnusedImportWarningForScalaVersionSpecific
object ZipStream {

def apply[A](value: Stream[A]): ZipStream[A] = new ZipStream(value)
Expand All @@ -18,7 +15,7 @@ object ZipStream {
ZipStream(fa.value.map(f))

def ap[A, B](ff: ZipStream[A => B])(fa: ZipStream[A]): ZipStream[B] =
ZipStream(ff.value.lazyZip(fa.value).map(_.apply(_)))
ZipStream((ff.value, fa.value).zipped.map(_.apply(_)))

override def product[A, B](fa: ZipStream[A], fb: ZipStream[B]): ZipStream[(A, B)] =
ZipStream(fa.value.zip(fb.value))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import cats.data._
import cats.kernel.Semigroup
import cats.syntax.either._
import cats.{~>, Applicative, Apply, FlatMap, Functor, Monad, NonEmptyParallel, Parallel}
import kernel.compat.scalaVersionSpecific._

@suppressUnusedImportWarningForScalaVersionSpecific
trait ParallelInstances extends ParallelInstances1 {
implicit def catsParallelForEitherValidated[E: Semigroup]: Parallel[Either[E, *], Validated[E, *]] =
new Parallel[Either[E, *], Validated[E, *]] {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cats
package data

import kernel.compat.scalaVersionSpecific._

abstract private[data] class ScalaVersionSpecificPackage {
type NonEmptyLazyList[+A] = NonEmptyLazyList.Type[A]
@deprecated("2.0.0-RC2", "Use NonEmptyLazyList")
Expand All @@ -12,7 +10,6 @@ abstract private[data] class ScalaVersionSpecificPackage {
def NonEmptyStream[A](head: A, tail: Stream[A]): NonEmptyStream[A] =
OneAnd(head, tail)

@suppressUnusedImportWarningForScalaVersionSpecific
@deprecated("2.0.0-RC2", "Use NonEmptyLazyList")
def NonEmptyStream[A](head: A, tail: A*): NonEmptyStream[A] =
OneAnd(head, tail.toStream)
Expand Down
3 changes: 0 additions & 3 deletions core/src/main/scala-2.13+/cats/data/ZipStream.scala
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package cats
package data

import kernel.compat.scalaVersionSpecific._

@deprecated("2.0.0-RC2", "Use ZipLazyList")
class ZipStream[A](val value: Stream[A]) extends AnyVal

@suppressUnusedImportWarningForScalaVersionSpecific
@deprecated("2.0.0-RC2", "Use ZipLazyList")
object ZipStream {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import cats.data._
import cats.kernel.Semigroup
import cats.syntax.either._
import cats.{~>, Applicative, Apply, FlatMap, Functor, Monad, NonEmptyParallel, Parallel}
import kernel.compat.scalaVersionSpecific._

@suppressUnusedImportWarningForScalaVersionSpecific
trait ParallelInstances extends ParallelInstances1 {
implicit def catsParallelForEitherValidated[E: Semigroup]: Parallel[Either[E, *], Validated[E, *]] =
new Parallel[Either[E, *], Validated[E, *]] {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cats.kernel
package instances
import compat.scalaVersionSpecific._

@suppressUnusedImportWarningForScalaVersionSpecific
trait StreamInstances extends StreamInstances1 {
implicit def catsKernelStdOrderForStream[A: Order]: Order[Stream[A]] =
new StreamOrder[A]
Expand Down Expand Up @@ -51,6 +49,6 @@ class StreamMonoid[A] extends Monoid[Stream[A]] {
override def combineN(x: Stream[A], n: Int): Stream[A] =
StaticMethods.combineNIterable(Stream.newBuilder[A], x, n)

override def combineAll(xs: IterableOnce[Stream[A]]): Stream[A] =
override def combineAll(xs: TraversableOnce[Stream[A]]): Stream[A] =
StaticMethods.combineAllIterable(Stream.newBuilder[A], xs)
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cats.kernel
package instances
import compat.scalaVersionSpecific._

@suppressUnusedImportWarningForScalaVersionSpecific
trait LazyListInstances extends LazyListInstances1 {
implicit def catsKernelStdOrderForLazyList[A: Order]: Order[LazyList[A]] =
new LazyListOrder[A]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package cats.kernel
package instances
import compat.scalaVersionSpecific._

@suppressUnusedImportWarningForScalaVersionSpecific
trait StreamInstances extends StreamInstances1 {
@deprecated("2.0.0-RC2", "Use cats.kernel.instances.lazyList")
implicit def catsKernelStdOrderForStream[A: Order]: Order[Stream[A]] =
Expand Down

0 comments on commit 40333b2

Please sign in to comment.