Value and is not a member of com.lucidchart.open.xtract.XmlReader
emanueloliveira23 opened this issue · 4 comments
emanueloliveira23 commented
First, thanks for the library. Seems to be amazing.
Issue
I made all imports, including Play's functional package, but the following error appears to compile:
value and is not a member of com.lucidchart.open.xtract.XmlReader[...]
.
For example:
import com.lucidchart.open.xtract.{XmlReader, __}
import com.lucidchart.open.xtract.XmlReader._
import play.api.libs.functional.syntax._
case class Foo(a: String, b: Int)
object Foo {
implicit val reader: XmlReader[Foo] = (
(__ \ "a").read[String] and // this is the 'and' which the compiler claims
(__ \ "b").read[Int]
)(apply _)
}
Can anyone help me? Do I misunderstand something?
Environment
- Scala: 2.12
- Play: 2.6
- OS: macOS mojave
tmccombs commented
What version of xtract are you using?
emanueloliveira23 commented
"com.lucidchart" %% "xtract" % "2.0.0"
tmccombs commented
Ah, yeah. So version 2.0 changed the syntax a little bit, and moved from play-syntax to cats. In version two your example would be:
import com.lucidchart.open.xtract.{XmlReader, __}
import com.lucidchart.open.xtract.XmlReader._
import cats.syntax.all._
case class Foo(a: String, b: Int)
object Foo {
implicit val reader: XmlReader[Foo] = (
(__ \ "a").read[String],
(__ \ "b").read[Int]
).mapN(apply _)
}
See https://github.com/lucidsoftware/xtract/blob/master/CHANGELOG.md
emanueloliveira23 commented
Great! Thank you @tmccombs.
I was following the tutorials and articles on the internet and they show in the old way.