package com.example.playground.monadic.parser.combinators;

import com.example.playground.result.Result;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.util.stream.BaseStream;

import static com.example.playground.monadic.parser.combinators.ParserResult.parserResult;

@NoArgsConstructor(access = AccessLevel.PRIVATE)
public final class Parsers {
    public static <T, E, I, S extends BaseStream<I, S>> Parser<T, E, I, S> result(T result) {
        return input -> Result.result(parserResult(result, input));
    }
}

@@ -533,11 +533,155 @@
 );%0A    %7D
+%0A%0A    public static %3CT, E, I, S extends BaseStream%3CI, S%3E%3E Parser%3CT, E, I, S%3E error(E error) %7B%0A        return input -%3E Result.error(error);%0A    %7D
 %0A%7D%0A

Add error parser