module type ASYNCHRONOUS =sig
..end
Markup.ml interface for monadic I/O libraries such as Lwt and Async.
This signature is implemented by Markup_lwt
, with a few additions.
Each function here corresponds directly to the function in the basic module
Markup
that has the same name. So, see Markup
for details.
The only difference is that functions here, all of which are higher-order
functions, take a function as argument that returns an 'a io
promise,
rather than returning an already-computed value.
type 'a
io
Promise type. Replaced by 'a Lwt.t
in Markup_lwt
.
module Encoding:sig
..end
Asynchronous counterpart to Markup.Encoding
.
val parse_xml : ?report:(Markup.location -> Markup.Error.t -> unit io) ->
?encoding:Encoding.t ->
?namespace:(string -> string option) ->
?entity:(string -> string option) ->
?context:[< `Document | `Fragment ] ->
(char, 'a) Markup.stream -> Markup.async Markup.parser
val write_xml : ?report:(Markup.signal * int -> Markup.Error.t -> unit io) ->
?prefix:(string -> string option) ->
([< Markup.signal ], 'a) Markup.stream -> (char, Markup.async) Markup.stream
val parse_html : ?report:(Markup.location -> Markup.Error.t -> unit io) ->
?encoding:Encoding.t ->
?context:[< `Document | `Fragment of string ] ->
(char, 'a) Markup.stream -> Markup.async Markup.parser
val write_html : ?escape_attribute:(string -> string) ->
?escape_text:(string -> string) ->
([< Markup.signal ], 'a) Markup.stream -> (char, Markup.async) Markup.stream
val fn : (unit -> char option io) ->
(char, Markup.async) Markup.stream
val to_string : (char, 'a) Markup.stream -> string io
val to_buffer : (char, 'a) Markup.stream -> Stdlib.Buffer.t io
val stream : (unit -> 'a option io) ->
('a, Markup.async) Markup.stream
val next : ('a, 'b) Markup.stream -> 'a option io
val peek : ('a, 'b) Markup.stream -> 'a option io
val transform : ('a -> 'b -> ('c list * 'a option) io) ->
'a -> ('b, 'd) Markup.stream -> ('c, Markup.async) Markup.stream
val fold : ('a -> 'b -> 'a io) ->
'a -> ('b, 'c) Markup.stream -> 'a io
val map : ('a -> 'b io) ->
('a, 'c) Markup.stream -> ('b, Markup.async) Markup.stream
val filter : ('a -> bool io) ->
('a, 'b) Markup.stream -> ('a, Markup.async) Markup.stream
val filter_map : ('a -> 'b option io) ->
('a, 'c) Markup.stream -> ('b, Markup.async) Markup.stream
val iter : ('a -> unit io) ->
('a, 'b) Markup.stream -> unit io
val drain : ('a, 'b) Markup.stream -> unit io
val to_list : ('a, 'b) Markup.stream -> 'a list io
val load : ('a, 'b) Markup.stream ->
('a, Markup.sync) Markup.stream io
load s
converts a general stream s
to a synchronous stream by
buffering it.
val tree : ?text:(string list -> 'a) ->
?element:(Markup.name -> (Markup.name * string) list -> 'a list -> 'a) ->
?comment:(string -> 'a) ->
?pi:(string -> string -> 'a) ->
?xml:(Markup.xml_declaration -> 'a) ->
?doctype:(Markup.doctype -> 'a) ->
([< Markup.signal ], 'b) Markup.stream -> 'a option io