Opam package demos

That was excactly the idea behind carcass (except that was totally agnostic to tooling, it just generates text files or hierarchies thereof). Basically each package could install it’s own variables and templates in say $(opam var etc)/carcass/$(PKG) to be looked up according to the lookup procedure, properly namespaced by opam/library names.

Never released it because in the end I thought it was better to try to create tools that by design do not need boilerplate… the current amount of bureaucracy and metadata needed for writing the tiniest program is nowadays insane. The existence of boilerplate generation tools does not curb the trend, so I decided not to add one more. (It also would also need a design round to remove the metaphor, it’s cute but a needless burden to learn).

Regarding code samples I think it would be much better to have code extraction from .mld files, see here for the broad idea. That way you can have a tutorial, verify that it compiles, and teach users of the eco-system that they can always:

odoc extract -d hello $(opam var $PKG)/odoc-pages/tutorials/hello.mld

to play with the actual sample. This is a very simple workflow for both authors and users. But people like their complexity.

3 Likes