package ppx_monoid
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
md5=a3080fb7b473bfebcb8724b53df1c27f
sha512=b2ac2c291dd0ade2aad61d78a5dd82a2dc4fd51d5455f4419481c2c26e2acb26753926a2581f55f2bd2b10b25159e7d7b87f5fef67b5315d799d2a86de359f50
Description
This is a syntax extension for OCaml to make building values of
monoids easier. Assumes the existence of two operations in scope for
some type t:
empty : t
(^^) : t -> t -> t
ppx-monoid, triggered by the PPX extension point monoid,
reinterprets the semicolon ; to mean the monoid operation ^^ and
the unit expression () to mean empty.
Added to opam-repository:
README
ppx-monoid
This is a syntax extension for OCaml to make building values of monoids easier. Assumes the existence of two operations in scope for some type t:
empty : t
(^^) : t -> t -> tppx-monoid, triggered by the PPX extension point monoid, reinterprets the semicolon ; to mean the monoid operation ^^ and the unit expression () to mean empty.
Example:
let empty = "" and (^^) = (^) in
begin%monoid
"hello";
" ";
"world"
endis translated to:
let empty = "" and (^^) = (^) in
"hello" ^^ " " ^^ "world"It is also possible to use concat or concatenate instead of monoid:
let empty = "" and (^^) = (^) in
begin%concat (* or 'concatenate' *)
"hello";
" ";
"world"
endSee the test/test.ml file for more examples of usage, and for examples of how the translation interacts with if then else and match expressions.
The main use case for this syntax extension is for writing code that generates HTML which consists of long sequences of concatenated bits of HTML.
Optional Dependencies
None
Used by
None
Conflicts
None
Build status
Results of building ppx_monoid with each compiler on check.ci.ocaml.org, run of against opam-repository 8d8d144. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 0.3.3 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure