package markup

  1. Overview
  2. Docs

Module type Markup.ASYNCHRONOUSSource

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.

Promises

Sourcetype 'a io

Promise type. Replaced by 'a Lwt.t in Markup_lwt.

Encodings

Sourcemodule Encoding : sig ... end

Asynchronous counterpart to Markup.Encoding.

XML

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

HTML

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

I/O

Sourceval fn : (unit -> char option io) -> (char, async) stream
Sourceval to_string : (char, _) stream -> string io
Sourceval to_buffer : (char, _) stream -> Buffer.t io

Stream manipulation

Sourceval stream : (unit -> 'a option io) -> ('a, async) stream
Sourceval next : ('a, _) stream -> 'a option io
Sourceval peek : ('a, _) stream -> 'a option io
Sourceval transform : ('a -> 'b -> ('c list * 'a option) io) -> 'a -> ('b, _) stream -> ('c, async) stream
Sourceval fold : ('a -> 'b -> 'a io) -> 'a -> ('b, _) stream -> 'a io
Sourceval map : ('a -> 'b io) -> ('a, _) stream -> ('b, async) stream
Sourceval filter : ('a -> bool io) -> ('a, _) stream -> ('a, async) stream
Sourceval filter_map : ('a -> 'b option io) -> ('a, _) stream -> ('b, async) stream
Sourceval iter : ('a -> unit io) -> ('a, _) stream -> unit io
Sourceval drain : ('a, _) stream -> unit io
Sourceval to_list : ('a, _) stream -> 'a list io
Sourceval load : ('a, _) stream -> ('a, sync) stream io

load s converts a general stream s to a synchronous stream by buffering it.

Utility

Sourceval 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 ], _) stream -> 'a option io
OCaml

Innovation. Community. Security.