3 ms·
ocsigen does this for OCaml: https://ocsigen.org/eliom/1.3.4/manual/html https://ocsigen.org/eliom/1.3.4/manual/html The syntax is fairly lightweight, just <<
by rwmj 8y ago
ocsigen does this for OCaml:
https://ocsigen.org/eliom/1.3.4/manual/html https://ocsigen.org/eliom/1.3.4/manual/html
The syntax is fairly lightweight, just << followed by valid, type checked XHTML ended by >>. There are also antiquotations so you can use it as a templating language.
For those of us generating XML from C I wrote a hairy set of C macros:
https://github.com/libguestfs/libguestfs/blob/master/common/utils/libxml2-writer-macros.h https://github.com/libguestfs/libguestfs/blob/master/common/...
so you can write code like this (which is not fully checked at compile time of course):
https://github.com/libguestfs/libguestfs/blob/4aa712d551f9d4f5cda2b01d3fe5c672f531142b/lib/launch-libvirt.c#L1068 https://github.com/libguestfs/libguestfs/blob/4aa712d551f9d4...
- Drup 8y agoRegarding ocsigen, It's more appropriate to point to tyxml[1] and its syntax extension [2]! Note that tyxml goes quite further than Rust's typed-html: the nesting is significantly more flexible, type inference is still complete, and it will verify additional properties like "don't use <a> inside <a>". It can also be used conjointly with reactive and/or isomorphic programming. [1]: https://ocsigen.org/tyxml/ https://ocsigen.org/tyxml/ [2]: https://ocsigen.org/tyxml/4.3.0/manual/ppx https://ocsigen.org/tyxml/4.3.0/manual/ppx
- jonathanyc 8y agoAs an OCaml user, I do not see at first glance how any of your statements about where tyxml “goes quite further” are true, with the exception of completeness on the Rust end (but I am very dubious that there is completeness on the OCaml end—HTML is not as simple as you’d think). This makes me think that if you’d like to convince people who are not OCaml users to look at your library, you should provide examples of why these things are true and how they are useful. Otherwise, we just come off as smug FP weenies.