I'm running into a compiler problem when using Scala7-M9 and json4s 3.0.1 with compiler versions 2.10.0 and 2.10.1
When compiling the short snippet of JSON parsing code, I get the following compiler error:
[error] JSON.scala:25: erroneous or inaccessible type
[error] JArray(children) <- json \ "children"
[error] ^
from this code:
import scalaz._
import Scalaz._
import org.json4s._
import org.json4s.native.JsonMethods._
object JSON {
def main(args: Array[String]) = {
val json = parse("""
{ "name": "joe",
"children": [
{
"name": "Mary",
"age": 5
},
{
"name": "Mazy",
"age": 3
}]
} """)
val names = for {
JArray(children) <- json \ "children"
JObject(child) <- children
JField("name", JString(name)) <- child
} yield(name)
println("Names: " + names)
}
}
Changing the imports to:
import scalaz.{Scalaz, \/}
import Scalaz.ToIdOps._
(in my real project I only need the / monad for some validation) fixes the issue.
Just wondering if anyone from the Scalaz/compiler world would have an idea what was causing the compiler error when I import the whole scalaz namespace and if it's a BUG I need to file.
Thanks.