diff --git a/core/src/main/scala/cats/Foldable.scala b/core/src/main/scala/cats/Foldable.scala index 1a7b5ff31f..6be1cb3882 100644 --- a/core/src/main/scala/cats/Foldable.scala +++ b/core/src/main/scala/cats/Foldable.scala @@ -55,7 +55,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s * * Example: * {{{ - * scala> import cats.Foldable, cats.implicits._ + * scala> import cats.Foldable, cats.syntax.all._ * scala> val fa = Option(1) * * Folding by addition to zero: @@ -89,7 +89,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s * * Example: * {{{ - * scala> import cats.Foldable, cats.Eval, cats.implicits._ + * scala> import cats.Foldable, cats.Eval, cats.syntax.all._ * scala> val fa = Option(1) * * Folding by addition to zero: @@ -505,7 +505,7 @@ trait Foldable[F[_]] extends UnorderedFoldable[F] with FoldableNFunctions[F] { s * combining them using the `MonoidK[G]` instance. * * {{{ - * scala> import cats._, cats.implicits._ + * scala> import cats._, cats.syntax.all._ * scala> val f: Int => Endo[String] = i => (s => s + i) * scala> val x: Endo[String] = Foldable[List].foldMapK(List(1, 2, 3))(f) * scala> val a = x("foo") diff --git a/core/src/main/scala/cats/data/Kleisli.scala b/core/src/main/scala/cats/data/Kleisli.scala index 9827ce87b0..a8b1f7b944 100644 --- a/core/src/main/scala/cats/data/Kleisli.scala +++ b/core/src/main/scala/cats/data/Kleisli.scala @@ -51,7 +51,7 @@ final case class Kleisli[F[_], -A, B](run: A => F[B]) { self => /** * Modify the output of the Kleisli function with `f`. * {{{ - * scala> import cats.data.Kleisli, cats.implicits._ + * scala> import cats.data.Kleisli, cats.syntax.all._ * scala> val takeHead = Kleisli[Option, List[Int], Int](_.headOption) * scala> takeHead.map(_.toDouble).run(List(1)) * res0: Option[Double] = Some(1.0) @@ -90,7 +90,7 @@ final case class Kleisli[F[_], -A, B](run: A => F[B]) { self => * Tip to tail Kleisli arrow composition. * Creates a function `A => F[C]` from [[run]] (`A => F[B]`) and the given Kleisli of `B => F[C]`. * {{{ - * scala> import cats.data.Kleisli, cats.implicits._ + * scala> import cats.data.Kleisli, cats.syntax.all._ * scala> val takeHead = Kleisli[Option, List[Int], Int](_.headOption) * scala> val plusOne = Kleisli[Option, Int, Int](i => Some(i + 1)) * scala> (takeHead andThen plusOne).run(List(1)) @@ -115,7 +115,7 @@ final case class Kleisli[F[_], -A, B](run: A => F[B]) { self => /** * Contramap the input using `f`, where `f` may modify the input type of the Kleisli arrow. * {{{ - * scala> import cats.data.Kleisli, cats.implicits._ + * scala> import cats.data.Kleisli, cats.syntax.all._ * scala> type ParseResult[A] = Either[Throwable, A] * scala> val parseInt = Kleisli[ParseResult, String, Int](s => Either.catchNonFatal(s.toInt)) * scala> parseInt.local[List[String]](_.combineAll).run(List("1", "2")) @@ -250,7 +250,7 @@ sealed private[data] trait KleisliFunctions { /** * Creates a Kleisli that ignores its input `A` and returns the given `F[B]`. * {{{ - * scala> import cats.data.Kleisli, cats.implicits._ + * scala> import cats.data.Kleisli, cats.syntax.all._ * scala> val takeHead = Kleisli((_:List[Int]).headOption) * scala> val makeList = Kleisli.liftF[Option, Unit, List[Int]](Some(List(1,2,3))) * scala> (makeList andThen takeHead).run(()) @@ -280,7 +280,7 @@ sealed private[data] trait KleisliFunctions { /** * Creates a Kleisli arrow ignoring its input and lifting the given `B` into applicative context `F`. * {{{ - * scala> import cats.data.Kleisli, cats.implicits._ + * scala> import cats.data.Kleisli, cats.syntax.all._ * scala> val pureOpt = Kleisli.pure[Option, Unit, String]("beam me up!") * scala> pureOpt.run(()) * res0: Option[String] = Some(beam me up!) diff --git a/core/src/main/scala/cats/syntax/reducible.scala b/core/src/main/scala/cats/syntax/reducible.scala index 1e07ad776e..12385a69fb 100644 --- a/core/src/main/scala/cats/syntax/reducible.scala +++ b/core/src/main/scala/cats/syntax/reducible.scala @@ -43,7 +43,7 @@ final class ReducibleOps0[F[_], A](private val fa: F[A]) extends AnyVal { * given `SemigroupK[G]`. * * {{{ - * scala> import cats._, cats.data._, cats.implicits._ + * scala> import cats._, cats.data._, cats.syntax.all._ * scala> val f: Int => Endo[String] = i => (s => s + i) * scala> val x: Endo[String] = NonEmptyList.of(1, 2, 3).reduceMapK(f) * scala> val a = x("foo") diff --git a/docs/faq.md b/docs/faq.md index d593e14196..ff1f041fd2 100644 --- a/docs/faq.md +++ b/docs/faq.md @@ -242,7 +242,7 @@ See the [contributing guide](CONTRIBUTING.md) for more information. The easiest way is probably using [Ammonite-REPL](http://ammonite.io/). Install it following the instructions there. Then in the amm console you can type in ```scala // interp.configureCompiler(_.settings.YpartialUnification.value = true) // If using scala 2.11 or 2.12 -import $ivy.`org.typelevel::cats-core:2.1.1`, cats._, cats.data._, cats.implicits._ +import $ivy.`org.typelevel::cats-core:@VERSION@`, cats._, cats.data._, cats.syntax.all._ ``` Or if you want, you can add these lines to `~/.ammonite/predef.sc` so that they are enabled every ammonite session. diff --git a/docs/guidelines.md b/docs/guidelines.md index cf7291eae1..0df205f434 100644 --- a/docs/guidelines.md +++ b/docs/guidelines.md @@ -116,7 +116,7 @@ An attempt to construct one without a proper `Monad[F]` instance would be incons for `EitherT[F, String, *]`. Such an instance will be derived if you use `Nested` instead: ```scala -import cats._, cats.data._, cats.implicits._ +import cats._, cats.data._, cats.syntax.all._ val a = EitherT(List(Left("err"), Right(1))) val x = (a *> a).value diff --git a/docs/imports.md b/docs/imports.md index c712c25c9a..a990098ea0 100644 --- a/docs/imports.md +++ b/docs/imports.md @@ -49,7 +49,7 @@ import cats.syntax.semigroup._ The import adds the `|+|` syntax. **Note**: Beware that if you import a type class instance or its syntax twice, you will receive conflicting implicits with a less than helpful error message. -This usually happens when importing different type classes in the same hierarchy or when importing syntax enrichment for all type classes using `cats.syntax.all._` or `cats.implicits._` together with a more specific import like `cats.syntax.option._` or `cats.instances.either._`. +This usually happens when importing different type classes in the same hierarchy or when importing syntax enrichment for all type classes using `cats.syntax.all._` together with a more specific import like `cats.syntax.option._` or `cats.syntax.either._`. Below is an example of this phenomenon: ```scala mdoc:reset:silent:fail diff --git a/docs/jump_start_guide.md b/docs/jump_start_guide.md index 045934fe0c..f87163590e 100644 --- a/docs/jump_start_guide.md +++ b/docs/jump_start_guide.md @@ -218,7 +218,7 @@ and that solves our problem for good. # Common issues -The Cats type class instances for standard library types are available in implicit scope and hence no longer have to be imported. If anything doesn't compile as expected, first make sure all the required Cats syntax implicits are in the scope — try importing ```cats.syntax.all._``` and see if the problem persists. The only exception is here is Cat's own ```Order``` and ```PartialOrder``` type classes which are available by importing ```cats.implicits._```. +The Cats type class instances for standard library types are available in implicit scope and hence no longer have to be imported. If anything doesn't compile as expected, first make sure all the required Cats syntax implicits are in the scope — try importing ```cats.syntax.all._``` and see if the problem persists. As mentioned before, though, it's better to use narrow imports, but if the code doesn't compile it's sometimes worth just importing the entire library to check if it solves the problem. If you're using `Futures`, make sure to provide an implicit `ExecutionContext` in the scope, otherwise Cats won't be able to infer implicit instances for `Future`'s type classes. diff --git a/docs/typeclasses/applicative.md b/docs/typeclasses/applicative.md index bf654c7533..7c9d5cab88 100644 --- a/docs/typeclasses/applicative.md +++ b/docs/typeclasses/applicative.md @@ -243,7 +243,7 @@ pair up (or apply functions to) values with the same key. Hence `Map[K, *]` has ## Syntax -Syntax for `Applicative` (or `Apply`) is available under the `cats.implicits._` import. The most +Syntax for `Applicative` (or `Apply`) is available under the `cats.syntax.all._` import. The most interesting syntax is focused on composing independent effects: it works just like the methods for composition we saw above (`map3`, `tuple3`, etc.), but achieves a slightly friendlier syntax by enriching Scala's standard tuple types. diff --git a/docs/typeclasses/lawtesting.md b/docs/typeclasses/lawtesting.md index 1c5f0e302b..c25d4c10b9 100644 --- a/docs/typeclasses/lawtesting.md +++ b/docs/typeclasses/lawtesting.md @@ -96,7 +96,7 @@ class TreeLawTests extends DisciplineSuite { } ``` -* `cats.implicits._` imports the instances we need for `Eq[Tree[Int]]`, which the laws use to compare trees. +* `cats.syntax.all._` imports the instances we need for `Eq[Tree[Int]]`, which the laws use to compare trees. * `FunctorTests` contains the functor laws. * `AnyFunSuite` defines the style of ScalaTest. * `FunSuiteDiscipline` provides `checkAll`, and must be mixed into `AnyFunSuite` diff --git a/scalafix/README.md b/scalafix/README.md index fb07eed78b..c98b464878 100644 --- a/scalafix/README.md +++ b/scalafix/README.md @@ -61,7 +61,7 @@ sbt scalafixAll github:typelevel/cats/Cats_v1_0_0 - [ ] FunctorFilter, MonadCombine, MonadFilter, MonadReader, MonadState, MonadTrans, MonadWriter and TraverseFilter are no longer in cats, the functionalities they provided are inhereted by the new cats-mtl project. Please check here for migration guide. -- [ ] Several cats-core type class instances for cats.kernel were moved from their companion objects to separate traits and thus require imports from cats.instances.xxx._ (or the recommended import cats.implicits._) now. See #1659 for more details. +- [ ] Several cats-core type class instances for cats.kernel were moved from their companion objects to separate traits and thus require imports from cats.syntax.xxx._ (or the recommended import cats.syntax.all._) now. See #1659 for more details. - [ ] foldLeftM is removed from Free, use foldM on Foldable instead, see #1117 for detail.