Subject: [PATCH] gnu: add ocaml-odoc.

From: Gabriel Hondet <[email-masked]>
Date: Sat, 04 May 2019 14:59:21 +0200

Hi everyone,

Please find enclosed a sequence of patches to add ocaml-odoc

Gabriel
From 5ba11eb3d3868ef92b6b2a37c6531963ec4ec6ab Mon Sep 17 00:00:00 2001
From: gabrielhdt <[email-masked]>
Date: Sat, 4 May 2019 14:34:05 +0200
Subject: [PATCH 1/4] gnu: Add ocaml-markup.

* gnu/packages/ocaml.scm (ocaml-markup): New variable.
---
 gnu/packages/ocaml.scm | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 6e69be3f19..82fd1cdd91 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -4960,3 +4960,45 @@ the full Core is not available, such as in Javascript.")
                license:asl2.0
                ;; MLton and sjs
                license:expat))))
+
+(define-public ocaml-markup
+  (package
+    (name "ocaml-markup")
+    (version "0.8.0")
+    (home-page "https://github.com/aantron/markup.ml")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url (string-append home-page ".git"))
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0aif4abvfmi9xc1pvw5n5rbm6rzkkpsxyvdn0lanr33rjpvkwdlm"))))
+    (build-system dune-build-system)
+    (inputs
+     `(("ocaml-uchar" ,ocaml-uchar)
+       ("ocaml-uutf" ,ocaml-uutf)
+       ("ocaml-lwt" ,ocaml-lwt)))
+    (native-inputs `(("ocaml-ounit" ,ocaml-ounit)))
+    (synopsis "Error-recovering functional HTML5 and XML parsers and writers")
+    (description "Markup.ml provides an HTML parser and an XML parser.  The
+parsers are wrapped in a simple interface: they are functions that transform
+byte streams to parsing signal streams.  Streams can be manipulated in various
+ways, such as processing by fold, filter, and map, assembly into DOM tree
+structures, or serialization back to HTML or XML.
+
+Both parsers are based on their respective standards.  The HTML parser, in
+particular, is based on the state machines defined in HTML5.
+
+The parsers are error-recovering by default, and accept fragments.  This makes
+it very easy to get a best-effort parse of some input.  The parsers can,
+however, be easily configured to be strict, and to accept only full documents.
+
+Apart from this, the parsers are streaming (do not build up a document in
+memory), non-blocking (can be used with threading libraries), lazy (do not
+consume input unless the signal stream is being read), and process the input in
+a single pass. They automatically detect the character encoding of the input
+stream, and convert everything to UTF-8.")
+    (license license:bsd-3)))
-- 
2.21.0

From 8883d5dce989627527bedfe67d37db3719723710 Mon Sep 17 00:00:00 2001
From: gabrielhdt <[email-masked]>
Date: Sat, 4 May 2019 14:47:13 +0200
Subject: [PATCH 2/4] gnu: Add ocaml-tyxml.

* gnu/packages/ocaml.scm (ocaml-tyxml): New variable.
---
 gnu/packages/ocaml.scm | 40 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 82fd1cdd91..3588836beb 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -5002,3 +5002,43 @@ consume input unless the signal stream is being read), and process the input in
 a single pass. They automatically detect the character encoding of the input
 stream, and convert everything to UTF-8.")
     (license license:bsd-3)))
+
+(define-public ocaml-tyxml
+  (package
+    (name "ocaml-tyxml")
+    (version "4.3.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ocsigen/tyxml.git")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0wv19xipkj8l2sks1h53105ywbjwk7q93fb7b8al4a2g9wr109c0"))))
+    (build-system dune-build-system)
+    (inputs
+     `(("ocaml-re" ,ocaml-re)
+       ("ocaml-seq" ,ocaml-seq)
+       ("ocaml-uutf" ,ocaml-uutf)
+       ("ocaml-ppx-tools-versioned" ,ocaml-ppx-tools-versioned)
+       ("ocaml-markup" ,ocaml-markup)))
+    (native-inputs
+     `(("ocaml-alcotest" ,ocaml-alcotest)))
+    (arguments `(#:jbuild? #t))
+    (home-page "https://github.com/ocsigen/tyxml/")
+    (synopsis "TyXML is a library for building correct HTML and SVG documents")
+    (description "TyXML provides a set of convenient combinators that uses the
+OCaml type system to ensure the validity of the generated documents.  TyXML can
+be used with any representation of HTML and SVG: the textual one, provided
+directly by this package, or DOM trees (@code{js_of_ocaml-tyxml}) virtual DOM
+(@code{virtual-dom}) and reactive or replicated trees (@code{eliom}).  You can
+also create your own representation and use it to instantiate a new set of
+combinators.
+
+@code{
+open Tyxml
+let to_ocaml = Html.(a ~a:[a_href \"ocaml.org\"] [txt \"OCaml!\"])
+}")
+    (license license:lgpl2.1)))
-- 
2.21.0

From 06bce0893b0a6a1fb2ab09d01e4fbfd2d3a75dd5 Mon Sep 17 00:00:00 2001
From: gabrielhdt <[email-masked]>
Date: Sat, 4 May 2019 14:48:38 +0200
Subject: [PATCH 3/4] gnu: Add ocaml-bisect-ppx.

* gnu/packages/ocaml.scm (ocaml-bisect-ppx): New variable.
---
 gnu/packages/ocaml.scm | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 3588836beb..787bbd855c 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -5042,3 +5042,33 @@ open Tyxml
 let to_ocaml = Html.(a ~a:[a_href \"ocaml.org\"] [txt \"OCaml!\"])
 }")
     (license license:lgpl2.1)))
+
+(define-public ocaml-bisect-ppx
+  (package
+    (name "ocaml-bisect-ppx")
+    (version "1.4.1")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/aantron/bisect_ppx.git")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "1vp3qvrkz7q25nbmvd40vhsnz2k9aqh17bnd21i3q8q0xlr5hdag"))))
+    (build-system dune-build-system)
+    (inputs
+     `(("ocaml-migrate-parsetree" ,ocaml-migrate-parsetree)
+       ("ocaml-ppx-tools-versioned" ,ocaml-ppx-tools-versioned)
+       ("ocaml-ounit" ,ocaml-ounit)))
+    (home-page "https://github.com/aantron/bisect_ppx")
+    (synopsis "Code coverage for OCaml")
+    (description "Bisect_ppx helps you test thoroughly.  It is a small
+preprocessor that inserts instrumentation at places in your code, such as
+if-then-else and match expressions.  After you run tests, Bisect_ppx gives a
+nice HTML report showing which places were visited and which were missed.
+
+Usage is simple - add package bisect_ppx when building tests, run your tests,
+then run the Bisect_ppx report tool on the generated visitation files.")
+    (license license:mpl2.0)))
-- 
2.21.0

From 8cf63e00d15182fc674fa6e75b2949aa460f0cce Mon Sep 17 00:00:00 2001
From: gabrielhdt <[email-masked]>
Date: Sat, 4 May 2019 14:53:58 +0200
Subject: [PATCH 4/4] gnu: Add ocaml-odoc.

* gnu/packages/ocaml.scm (ocaml-odoc): New variable.
---
 gnu/packages/ocaml.scm | 54 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/gnu/packages/ocaml.scm b/gnu/packages/ocaml.scm
index 787bbd855c..6cb597e75f 100644
--- a/gnu/packages/ocaml.scm
+++ b/gnu/packages/ocaml.scm
@@ -5072,3 +5072,57 @@ nice HTML report showing which places were visited and which were missed.
 Usage is simple - add package bisect_ppx when building tests, run your tests,
 then run the Bisect_ppx report tool on the generated visitation files.")
     (license license:mpl2.0)))
+
+(define-public ocaml-odoc
+  (package
+    (name "ocaml-odoc")
+    (version "1.4.0")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://github.com/ocaml/odoc")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32
+         "0br11cw6wa0mwafja4xdb45d2f8908l6nzdq5mw5lbfq2jnp68km"))))
+    (build-system dune-build-system)
+    (inputs
+     `(("ocaml-alcotest" ,ocaml-alcotest)
+       ("ocaml-markup" ,ocaml-markup)
+       ("ocaml-sexplib" ,ocaml-sexplib)
+       ("ocaml-re" ,ocaml-re)
+       ("ocaml-uutf" ,ocaml-uutf)))
+    (native-inputs
+     `(("ocaml-astring" ,ocaml-astring)
+       ("ocaml-cmdliner" ,ocaml-cmdliner)
+       ("ocaml-cppo" ,ocaml-cppo)
+       ("ocaml-fpath" ,ocaml-fpath)
+       ("ocaml-result" ,ocaml-result)
+       ("ocaml-tyxml" ,ocaml-tyxml)
+       ("ocaml-bisect-ppx" ,ocaml-bisect-ppx)))
+    (home-page "https://github.com/ocaml/odoc")
+    (synopsis "OCaml documentation generator")
+    (description "@emph{odoc} is a documentation generator for OCaml.  It reads
+@emph{doc comments}, delimited with @code{(** ... *)}, and outputs
+@acronym{HTML}.
+
+Text inside doc comments is marked up in ocamldoc syntax:
+@code{
+val compare : string -> string -> int
+(** [compare s1 s2] compares [s1] and [s2] in {e lexicographic} order.  The
+    result is negative if [s1] precedes [s2], positive if [s1] follows [s2],
+    and zero if [s1] and [s2] are equal. *)
+}
+
+The syntax reference is
+@uref{https://caml.inria.fr/pub/docs/manual-ocaml/ocamldoc.html#sec357, here}.
+There is also an
+@uref{https://caml.inria.fr/pub/docs/manual-ocaml/ocamldoc.html#sec352,
+explanation} of how to attach comments to specific types, values, and other
+elements in your program.
+
+odoc's main advantage over ocamldoc is an accurate cross-referencer, which
+handles the complexity of the OCaml module system.")
+    (license license:isc)))
-- 
2.21.0