Package fj.parser
Class Result<I,A>
java.lang.Object
fj.parser.Result<I,A>
- All Implemented Interfaces:
Iterable<A>
A parse result made up of a value (A) and the remainder of the parse input (I).
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbimap()
First-class bifunctor map.<B,
J> Result <J, B> A bifunctor map across both the remainder of the parse input and the parse value.final boolean
final int
hashCode()
iterator()
Returns an iterator over the parse value.mapRest()
First-class function mapping across the remainder of the parse input.Maps the given function across the remainder of the parse input.mapValue()
First-class function mapping across the parse value.Maps the given function across the parse value.rest()
The remainder of the parse input.result()
First-class construction of a result.static <A,
I> Result <I, A> result
(I i, A a) Construct a result with the given remainder of the parse input and parse value.final String
toString()
value()
The parsed value.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
i
-
a
-
-
Constructor Details
-
Result
-
-
Method Details
-
hashCode
public final int hashCode() -
toString
-
equals
-
rest
The remainder of the parse input.- Returns:
- The remainder of the parse input.
-
value
The parsed value.- Returns:
- The parsed value.
-
mapRest
Maps the given function across the remainder of the parse input.- Parameters:
f
- The function to map with.- Returns:
- A result with a different parse input.
-
mapRest
First-class function mapping across the remainder of the parse input.- Returns:
- A first-class function mapping across the remainder of the parse input.
-
mapValue
Maps the given function across the parse value.- Parameters:
f
- The function to map with.- Returns:
- A result with a different parse value.
-
mapValue
First-class function mapping across the parse value.- Returns:
- A first-class function mapping across the parse value.
-
bimap
A bifunctor map across both the remainder of the parse input and the parse value.- Parameters:
f
- The function to map the remainder of the parse input with.g
- The function to map the parse value with.- Returns:
- A result with a different parse input and parse value.
-
bimap
First-class bifunctor map.- Returns:
- A first-class bifunctor map.
-
iterator
Returns an iterator over the parse value. This method exists to permit the use in afor
-each loop. -
result
Construct a result with the given remainder of the parse input and parse value.- Parameters:
i
- The remainder of the parse input.a
- The parse value.- Returns:
- A result with the given remainder of the parse input and parse value.
-
result
First-class construction of a result.- Returns:
- A first-class function for construction of a result.
-