Following the issue raised here, this PR proposes a new parsing API where end of input conditions are explicit:
(** [read_char source] reads a single character from the input. Returns
[None] if the end of input has been reached..*)
val read_char : t -> char option Monad.t
(** [read_string source size] reads exactly [size] bytes from [source] and
return them as a string. Returns [None] if there are less than [size]
characters available in the input. *)
val read_string : t -> int -> string option Monad.t
This allows to react to end-of-input conditions without swallowing other kind of IO errors.
Following the issue raised here, this PR proposes a new parsing API where end of input conditions are explicit:
This allows to react to end-of-input conditions without swallowing other kind of IO errors.