module type ASYNCHRONOUS = sig .. end interface for monadic I/O libraries such as Lwt and Async. This signature is included in the signature of Markup_lwt, with type 'a io replaced by 'Lwt.t. To use the functions in this interface, use Markup_lwt. A Markup_async module has not (yet) been implemented.

All of the functions here correspond directly to functions in Markup with the same name. See that module for details on each function.

The difference is that functions here can take 'a io (i.e. 'Lwt.t) threads instead of plain functions as arguments. As a consequence, all of them evaluate to either async streams, or to threads of type 'a io.

Note that several functions in Markup can take async streams as arguments, such as map, parse_xml, or trim. Where those functions, like trim, don't take another function as argument, they are not duplicated in this signature. map and parse_xml are provided here because some of their function arguments are replaced by 'a io threads.

All functions here accept both sync and async streams as arguments.


type 'a io 
Thread type. Replaced by 'Lwt.t in Markup_lwt.


module Encoding: sig .. end
Asynchronous counterpart to Encoding.


val parse_xml : 
?report:(location -> Error.t -> unit io) ->
?encoding:Encoding.t ->
?namespace:(string -> string option) ->
?entity:(string -> string option) ->
?context:[< `Document | `Fragment ] ->
(char, 'a) stream -> async parser
val write_xml : 
?report:(signal * int -> Error.t -> unit io) ->
?prefix:(string -> string option) ->
([< signal ], 'a) stream -> (char, async) stream


val parse_html : 
?report:(location -> Error.t -> unit io) ->
?encoding:Encoding.t ->
?context:[< `Document | `Fragment of string ] ->
(char, 'a) stream -> async parser
val write_html : ([< signal ], 'a) stream -> (char, async) stream


val fn : 
(unit -> char option io) ->
(char, async) stream
val to_string : (char, 'a) stream -> string io
val to_buffer : (char, 'a) stream -> Buffer.t io

Stream manipulation

val stream : 
(unit -> 'a option io) ->
('a, async) stream
val next : ('a, 'b) stream -> 'a option io
val peek : ('a, 'b) stream -> 'a option io
val transform : 
('a -> 'b -> ('c list * 'a option) io) ->
'a -> ('b, 'd) stream -> ('c, async) stream
val fold : 
('a -> 'b -> 'a io) ->
'a -> ('b, 'c) stream -> 'a io
val map : 
('a -> 'b io) ->
('a, 'c) stream -> ('b, async) stream
val filter : 
('a -> bool io) ->
('a, 'b) stream -> ('a, async) stream
val filter_map : 
('a -> 'b option io) ->
('a, 'c) stream -> ('b, async) stream
val iter : 
('a -> unit io) ->
('a, 'b) stream -> unit io
val drain : ('a, 'b) stream -> unit io
val to_list : ('a, 'b) stream -> 'a list io
val load : 
('a, 'b) stream ->
('a, sync) stream io
load s converts a general stream s to a synchronous stream by buffering it.


val tree : 
?text:(string list -> 'a) ->
?element:(name -> (name * string) list -> 'a list -> 'a) ->
?comment:(string -> 'a) ->
?pi:(string -> string -> 'a) ->
?xml:(xml_declaration -> 'a) ->
?doctype:(doctype -> 'a) ->
([< signal ], 'b) stream -> 'a option io