title: Pattern matching on Parsers Success In Scala
body: <p>I'm new to Scala, and have been trying to use its excellent combinator parser library. I've been trying to get this code to compile:</p>
  
  <pre><code>import scala.util.parsing.combinator._
  ...
  val r:Parsers#ParseResult[Node] = parser.parseAll(parser.suite,reader)
  r match {
    case Success(r, n) =&gt; println(r)
    case Failure(msg, n) =&gt; println(msg)
    case Error(msg, n) =&gt; println(msg)
  }
  ...
  </code></pre>
  
  <p>But I keep getting these errors: </p>
  
  <pre><code>TowelParser.scala:97: error: not found: value Success
    case Success(r, n) =&gt; println(r)
         ^
  TowelParser.scala:98: error: not found: value Failure
    case Failure(msg, n) =&gt; println(msg)
  
  TowelParser.scala:99: error: object Error is not a case class constructor, nor does it have an unapply/unapplySeq method
    case Error(msg, n) =&gt; println(msg)
  </code></pre>
  
  <p>I've tried lots of different things like:</p>
  
  <pre><code>case Parsers#Success(r, n) =&gt; println(r)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>case Parsers.Success(r, n) =&gt; println(r)
  </code></pre>
  
  <p>and</p>
  
  <pre><code>import scala.util.parsing.combinator.Parsers.Success
  </code></pre>
  
  <p>But I can't seem to get this to compile. I'm sure there's probably something obvious I'm missing, but I've been at it for a while, and google doesn't seem to have any good examples of this.</p>
  
  <p>Thanks!</p>