package markup-lwt

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Lwt interface to Markup.ml.

The majority of the functions in this interface are listed in the signature Markup.ASYNCHRONOUS, and are not directly included on this page. There are also additional Lwt functions in module Markup_lwt_unix. Those are based on Lwt_io, and have been separated to make this module Markup_lwt usable on js_of_ocaml, which does not support Lwt_io.

This module is available if Markup.ml is installed when Lwt is installed, i.e.

opam install lwt markup

To link with this module, depend on the findlib package markup.lwt instead of package markup.

include Markup.ASYNCHRONOUS with type 'a io := 'a Lwt.t

Promises

Encodings

module Encoding : sig ... end

Asynchronous counterpart to Markup.Encoding.

XML

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

HTML

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

I/O

val fn : (unit -> char option Lwt.t) -> (char, Markup.async) Markup.stream
val to_string : (char, _) Markup.stream -> string Lwt.t
val to_buffer : (char, _) Markup.stream -> Buffer.t Lwt.t

Stream manipulation

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

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

Utility

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 ], _) Markup.stream -> 'a option Lwt.t
val lwt_stream : 'a Lwt_stream.t -> ('a, Markup.async) Markup.stream

Adapts an Lwt stream to a Markup.ml stream.

val to_lwt_stream : ('a, _) Markup.stream -> 'a Lwt_stream.t

Adapts a Markup.ml stream to an Lwt stream.

val ensure_tail_calls : ?hook:(exn -> unit) ref -> unit -> unit
  • deprecated

    Not necessary since Markup.ml 0.7.4.

OCaml

Innovation. Community. Security.