package tyxml

  1. Overview
  2. Docs
A library for building correct HTML and SVG documents

Install

Dune Dependency

Authors

Maintainers

Sources

tyxml-4.6.0.tbz
sha256=bfeb673c6b4e120a4eca4c48448add47dc3f8d02c2b40f63ffdccc4e91c902dd
sha512=69750eeaf467014282087bf9628f3278f3e5f00f4c7400358750d208664cfc3f79a5cba16767d2935e53477d1a6862fe08c5b801b69052ec12e09d1a93a5e9b4

doc/src/tyxml.functor/xml_wrap.ml.html

Source file xml_wrap.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
(* TyXML
 * http://www.ocsigen.org/tyxml
 * Copyright (C) 2013 Gabriel Radanne <drupyog+caml@zoho.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, with linking exception;
 * either version 2.1 of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1301, USA.
*)

module type T = sig
  type 'a t
  val return : 'a -> 'a t

  type (-'a, 'b) ft
  val fmap : ('a, 'b) ft -> 'a t -> 'b t

  type 'a tlist
  val nil : unit -> 'a tlist
  val singleton : 'a t -> 'a tlist
  val cons : 'a t -> 'a tlist -> 'a tlist
  val append : 'a tlist -> 'a tlist -> 'a tlist
  val map : ('a, 'b) ft -> 'a tlist -> 'b tlist
end

module type NoWrap =
  T with type 'a t = 'a
     and type 'a tlist = 'a list
     and type (-'a, 'b) ft = 'a -> 'b

module NoWrap = struct
  type 'a t = 'a
  type 'a tlist = 'a list
  type (-'a, 'b) ft = 'a -> 'b
  external return : 'a -> 'a = "%identity"
  let fmap f :  'a t -> 'b t = f

  let nil () = []
  let singleton x = [x]
  let cons x xs = x::xs
  let append x y= x@y
  let map = List.map
end
OCaml

Innovation. Community. Security.