ap
This module contains ap1
through ap22
, which allow for the application of a parser returning a function of arity N
to N
parsers.
The combinators contained in this module all sequence a number of parsers together, but are capable of combining the results generated by these parsers into a single value with a function of the correct arity produced by the first parser. This is a clean way of putting together multiple parsers and getting a meaningful result out.
Attributes
- Since
-
4.0.0
- Example
-
scala> import parsley.character.char scala> import parsley.ap.{ap2, ap3} scala> case class Add(x: Int, y: Int) scala> val p = ap2(pure(Add), char('a').as(4), char('b').as(5)) scala> p.parse("ab") val res0 = Success(Add(4, 5)) scala> val q = ap3(pure((x: Int, y: Int, z: Int) => x * y + z), char('a').as(3), char('b').as(2), char('c').as(5)) scala> q.parse("abc") val res1 = Success(11) scala> q.parse("ab") val res2 = Failure(..)
- Source
- ap.scala
- Graph
-
- Supertypes
- Self type
-
ap.type
Members list
Value members
Concrete methods
This combinator allows the function that results from one parser to be applied to the result of another parser.
This combinator allows the function that results from one parser to be applied to the result of another parser.
Effectively alias for <*>
, to be consistent with the other ap
variants.
Value parameters
- pf
-
the parser whose result is a function to map across the result of
p1
. - px
-
the second parser to perform.
Attributes
- Returns
-
a parser that applies the function
f
resulting frompf
to the resultx
of the parserp1
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity ten.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity eleven.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity twelve.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity thirteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity fourteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity fifteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity sixteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity seventeen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity eighteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity nineteen.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity two.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity twenty.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity twenty-one.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity twenty-two.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity three.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity four.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity five.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity six.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity seven.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity eight.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
This combinator applies the given parsers in sequence and then applies the function returned by pf
of to all of the results of the other parsers.
Firstly, each parser is parsed in turn, each producing a result (and the first, a function f
). So long as all of the parsers succeeded, the combinator can succeed by returning the application of the function f
to all the arguments. If any of the parsers fails, the entire combinator fails.
Value parameters
- pf
-
a parser that returns a function to apply to the results of the parsers with arity nine.
Attributes
- Returns
-
a parser that parses all of the given parsers in order, and then combines their results with
f
. - Source
- ap.scala