// Path: src/main/java/com/github/kmizu/jcombinator/datatype/Function1.java
// public interface Function1<T1, R> {
//     R invoke(T1 arg);
// }


import com.github.kmizu.jcombinator.datatype.Function1;
package com.github.kmizu.jcombinator;


/**
 * This parser translate the result value `T` to `R`
 * applying `Function&lt;T, R&gt;`.
 * @param <T> the value type before translation
 * @param <R> the value type after translation
 */
public class MapParser<T, R> implements Parser<R> {
    private final Parser<T>       parser;
    private final Function1<T, R> fn;

// Path: src/main/java/com/github/kmizu/jcombinator/datatype/Function1.java
// public interface Function1<T1, R> {
//     R invoke(T1 arg);
// }


// Path: src/main/java/com/github/kmizu/jcombinator/MapParser.java
import com.github.kmizu.jcombinator.datatype.Function1;

package com.github.kmizu.jcombinator;


/**
 * This parser translate the result value `T` to `R`
 * applying `Function&lt;T, R&gt;`.
 * @param <T> the value type before translation
 * @param <R> the value type after translation
 */
public class MapParser<T, R> implements Parser<R> {
    private final Parser<T>       parser;
    private final Function1<T, R> fn;

    public MapParser(Parser<T> parser, Function1<T, R> fn) {