LazyChooseParsley

final class LazyChooseParsley[P, +A](pq: => (P, P))(con: P => Parsley[A])

This class exposes a ternary operator on pairs of parsers.

This class exposes a ternary operator on pairs of parsers.

Value Params
con

A conversion (if required) to turn elements of pq into parsers

pq

The parsers which serve the branches of the if

Version

1.0.0

class Object
trait Matchable
class Any

Value members

Concrete methods

def ?:(b: => Parsley[Boolean]): Parsley[A]

This is an if statement lifted to the parser level. Formally, this is a selective functor operation, equivalent to (branch b.map(boolToEither) (p.map(const)) (q.map(const))). Note: due to Scala operator associativity laws, this is a right-associative operator, and must be properly bracketed, technically the invokee is the rhs...

This is an if statement lifted to the parser level. Formally, this is a selective functor operation, equivalent to (branch b.map(boolToEither) (p.map(const)) (q.map(const))). Note: due to Scala operator associativity laws, this is a right-associative operator, and must be properly bracketed, technically the invokee is the rhs...

Value Params
b

The parser that yields the condition value

Returns

The result of either p or q depending on the return value of the invokee