score:4
Accepted answer
You need to specify how to handle whitespace, for example the following fails
import fastparse._
import fastparse.NoWhitespace._
def ab[_:P] = P("a" ~ "b")
assert(parse("a b", ab(_)).isSuccess)
because "a b"
contains spaces, whilst the following passes
import fastparse._
import fastparse.SingleLineWhitespace._
def ab[_:P] = P("a" ~ "b")
assert(parse("a b", ab(_)).isSuccess)
becase import fastparse.SingleLineWhitespace._
provides whitespace consumer. If we look at the definition of ~
def ~[V, R](other: P[V])
(implicit s: Implicits.Sequencer[T, V, R],
whitespace: P[Any] => P[Unit],
ctx: P[_]): P[R] = macro MacroImpls.parsedSequence[T, V, R]
we see implicit whitespace: P[Any] => P[Unit]
requirement which explains No implicit view available
error. The whitespace imports provide this capability, for example
object NoWhitespace {
implicit object noWhitespaceImplicit extends (ParsingRun[_] => ParsingRun[Unit]){
def apply(ctx: ParsingRun[_]) = ctx.freshSuccessUnit()
}
}
where we see ParsingRun[_] => ParsingRun[Unit]
implicit function.
score:2
You missed one more import
import NoWhitespace._
Source: stackoverflow.com
Related Query
- Migration play from 2.2 to 2.3: No implicit view available from Any
- No implicit view available from fastparse.P[Any] => fastparse.P[Unit]
- json4s, "no implicit view available from List of case class to JValue" when attempting to combine
- No implicit view available from K => Ordered[K]. Error occurred in an application involving default arguments
- No Implicit View Available
- No implicit view available for partially applied method
- Casbah: No implicit view available error
- MappedEnum - No implicit view available
- No implicit view avaliable from A => Ordered[A] while using default values
- getting Suspicious application of an implicit view when converting from Option(lang.Long) to Long
- Unexpected implicit resolution based on inference from return type
- Could/should an implicit conversion from T to Option[T] be added/created in Scala?
- Implicit conversion from String to Int in scala 2.8
- Scala implicit conversion from parent trait
- scala implicit or explicit conversion from iterator to iterable
- Implicit conversion from Int to Double in scala doesn't work
- How can I get Class[T] from an implicit ClassTag[T]?
- Which are the implicit objects available by default on templates?
- Access public available Amazon S3 file from Apache Spark
- How to pass flash data from controller to view with Play! framework
- Scala: Implicit Conversion From Generic Type to Second Generic Type
- Test if implicit conversion is available
- How can an implicit be unimported from the Scala repl?
- scala source implicit conversion from Int to RichInt
- Implicit conversion from array to list
- Unable to provide implicit conversion from DateTime to Ordered using implicit conversion to Comparable
- Implicit Conversion from Any to Dynamic
- Exclude a specific implicit from a Scala project
- Getting implicit scala Numeric from Azavea Numeric
- How to distinguish compiler-inferred implicit conversion from explicitly invoked one?
More Query from same tag
- How can I access sub-projects of an sbt-plugin by using it as dependency in a multi-project build?
- JDB ignores breakpoint for method in Scala object
- Scala: Self types in Constructors for generic classes
- Yet another "Unable to instantiate activity ComponentInfo" with Scala
- Rectangle Class (objects) can have two intrinsic parameters length and width. How to write (independent) function to calculate the area?
- How to import libraries in Spark Notebook
- EmrOptimizedSparkSqlParquetOutputCommitter not found
- Session must be bound error using Squeryl
- Combining nested lists in Scala - flattened Carthesian product
- Counting occurrence of word in text - Apache Spark Scala
- Compute median of up to 5 in Scala
- How to implement catalog / registry while obeying immutability and "rules" of functional programming?
- Spark createStream error when creating a stream to decode byte arrays in IntelliJ using the Scala plugin
- scala list.par within an actor
- Mockito: 0 matchers expected, 1 recorded
- How to use cdn url with play framework and scala for image display?
- How to make Play 2 Scala work with remote PostgreSQL db server?
- How can I set a logicalType in a spark-avro 2.4 schema?
- How to setup Play Slick with Postgresql
- How to define a more concise scala function
- How to quickly find keys matching a pattern in an AWS S3 bucket?
- Spray JSON: How to get implicitly declared objects into read and write methods?
- Conflicting cross-version suffixes (sbt, Scala-STM, Play-JSON)
- spark sql query with percentage issue
- Sbt : multi task ordering
- Run http tests until AMQ msgs consumed
- Serialize to object using scala mongo driver?
- Why does database initialization fail with "ERROR: improper qualified name (too many dotted names)"?
- Apache Spark Start multiple SparkContext instances
- Why won't Scala recognize that I'm extending ListModel<E>?