/** * Returns a parser that produces a digit (0 to 9). * * @param missing The error if there is no character on the stream to produce a digit with. * @param sat The error if the produced character is not a digit. * @return A parser that produces a digit (0 to 9). */ public static <E> Parser<Stream<Character>, Digit, E> digit( final F0<E> missing, final F<Character, E> sat) { return StreamParser.satisfy(missing, sat, c -> Character.isDigit(c)) .map(c1 -> Digit.fromChar(c1).some()); }