expose blocking decoder in CCSexpM

This commit is contained in:
Simon Cruanes 2015-10-04 21:11:12 +02:00
parent 5e6ade9f68
commit 1f463c1e9c
2 changed files with 12 additions and 2 deletions

View file

@ -309,11 +309,13 @@ module MakeDecode(M : MONAD) = struct
expr_or_end (fun _ x -> M.return (`Ok x)) t expr_or_end (fun _ x -> M.return (`Ok x)) t
end end
module D = MakeDecode(struct module ID_MONAD = struct
type 'a t = 'a type 'a t = 'a
let return x = x let return x = x
let (>>=) x f = f x let (>>=) x f = f x
end) end
module D = MakeDecode(ID_MONAD)
let parse_string s : t or_error = let parse_string s : t or_error =
let n = String.length s in let n = String.length s in

View file

@ -86,6 +86,14 @@ module MakeDecode(M : MONAD) : sig
long enough or isn't a proper S-expression *) long enough or isn't a proper S-expression *)
end end
module ID_MONAD : MONAD
(** The monad that just uses blocking calls as bind
@since NEXT_RELEASE *)
module D : module type of MakeDecode(ID_MONAD)
(** Decoder that just blocks when input is not available
@since NEXT_RELEASE *)
val parse_string : string -> t or_error val parse_string : string -> t or_error
(** Parse a string *) (** Parse a string *)