[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [MirageOS-devel] pretty charts from OCaml and js_of_ocaml

On 17 Jun 2015, at 11:29, Andy Ray <andy.ray@xxxxxxxxxxx> wrote:
>> Andy: this seems like a good time to figure out how to best embed HTML
>> toplevel printers in IOCamlJS from these sorts of libraries (it also came up
>> in the URI library, which wanted to embed a hyperlink). Are there any best
>> practises for this in terms of ocamlfind packaging and such, or is it just a
>> matter of building a custom toplevel formatter and calling some
>> initialisation code in the notebook?
> The simplest option might be to provide a "xyz.notebook" subpackage
> which references the main library and installs the iocaml printers.
> Another solution could be to define an ocamlfind predicate such as
> "notebook" which will automatically add the printers from the META
> file.
> archive(notebook) += "xyz_iocaml_printers.cma"
> For iocamljs the kernel would then need to be compiled with
> "-predicates notebook" added to the ocamlfind build command.  For
> bytecode iocaml you would need to add "Topfind.add_predicates [
> "notebook" ];" to the init file.
> I am not so sure this second solution will play all that nicely with
> the likes of oasis though - to do it properly the tools will need to
> be taught about the notebook predicate in the same way they handle the
> toploop predicate currently.

The notebook (or perhaps toploop_js to be more specific?) predicate
does seem like the right way to do things, despite the OASIS tooling
issue.  We may be able to do something in the iocaml build loop to
do a separate query for the new predicate based on the results from a
search for toploop.

I'm just wondering how likely it is that a package will want to have
multiple toploop printers (a dumb HTML one would just be the normal
toploop wrapped in `<pre>`, or a fancy IOCamlJS interactive one).

MirageOS-devel mailing list



Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.