Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can opa extensions be written in Ocaml?

Tags:

ocaml

opa

I notice that included in the source of the OpaWhiteBoard example, there is a .ml file here: https://github.com/hhugo/OpaWhiteBoard/blob/master/src/opacairo/cairo.ml

This appears to be OCaml with some directives ("##"). I'm guessing this means it's possible to write extensions to Opa in OCaml, correct?

like image 472
aneccodeal Avatar asked Jul 10 '11 20:07

aneccodeal


People also ask

Where does opam install?

Your libraries are installed to the directory returned by opam var lib , which is by default ~/. opam/<switch>/lib .

What is opam switch?

opam switchThis command enables the user to have several installations on disk, each with their own prefix, set of installed packages, compiler version, etc. Use cases include having to work or test with different OCaml versions, keeping separate development environments for specific projects, etc.

How do I disable sandboxing opam?

You need to disable the sandbox by using opam init --disable-sandboxing . bwrap is the tool that is creating sandboxes.


1 Answers

Yes you can with OPA-plugin-builder.

The book is still a work in progress (http://opalang.org/resources/book/index.html) and we will complete the plugin builder part as soon as we can.

But you can guess how it works looking at the Makefile: https://github.com/hhugo/OpaWhiteBoard/blob/master/Makefile

And the cairo.ml plugin: https://github.com/hhugo/OpaWhiteBoard/blob/master/src/opacairo/cairo.ml

The '##' directive are here in particularly to register functions and their types in OPA.

like image 152
Cédrics Avatar answered Sep 27 '22 18:09

Cédrics