여기에서 얻은 코드는 다음과 같습니다. http://underscore.io/blog/posts/2015/06/10/an-introduction-to-cats.html.고양이는 기호를 해결할 수 없습니다 | @ |
import cats.data.Xor
import cats.data.{Validated, Xor}
import cats.syntax.apply._ // For |@| syntax
import cats.std.list._
val v1: ValidatedR = valid(1)
val v2: ValidatedR = invalid(List("Accumulates this"))
val v3: ValidatedR = invalid(List("And this"))
(v1 |@| v2 |@| v3) map { _ + _ + _ }
그러나, 나는 점점 해요 :
Cannot resolve symbol |@|
내 build.sbt
: 내가 가져 오거나 사용해야 다른 아무것도
val snapshots = "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"
val algebraVersion = "0.2.0-SNAPSHOT"
val catsVersion = "0.1.0-SNAPSHOT"
val algebra = "org.spire-math" %% "algebra" % algebraVersion
val algebraStd = "org.spire-math" %% "algebra-std" % algebraVersion
val cats = "org.spire-math" %% "cats-core" % catsVersion
val catsStd = "org.spire-math" %% "cats-std" % catsVersion
scalaVersion := "2.11.6"
libraryDependencies ++=
Seq(
algebra, algebraStd,
cats, catsStd
)
resolvers += snapshots
있습니까?
가져 오기가 이제'cats.syntax.cartesian._'이고'List' 인스턴스도'cats.instances.list._'와 함께 가져올 수 있습니다. 아마 당신이 시작한다면 가장 쉬운 방법은'import cats.implicits._'를 사용하는 것입니다. –
'cats.syntax.cartesian._'을 가져올 때'오류 : (2, 22) 객체 데카르트가 패키지 cats.syntax의 멤버가 아닙니다' ^ – octavian
기사에서 언급 된 고양이 버전을 사용하고 있습니까? –