From: John Whitington <john@coherentgraphics.co.uk>
To: "caml-list@inria.fr" <caml-list@inria.fr>
Subject: [Caml-list] ANN: ppx_blob v0.1
Date: Sat, 11 Oct 2014 21:00:15 +0100 [thread overview]
Message-ID: <54398C4F.4020707@coherentgraphics.co.uk> (raw)
Hi,
Ppx_blob is an OCaml ppx to include a binary blob from a file as a
string. Writing [%blob "filename"] will replace the string with the
contents of the file at compile time. This allows the inclusion of
arbitary, possibly compressed, data, without the need to respect OCaml's
lexical conventions. This allows for smaller executables, and a proper
separation of data and code.
https://github.com/johnwhitington/ppx_blob
(Shortly with "opam install ppx_blob")
You will need OCaml version 4.02 or later.
For example, assuming the existence of "META" in the current directory:
OCaml version 4.02.0
# #use "topfind";;
# #require "ppx_blob";;
# let meta = [%blob "META"];;
val meta : string =
"name=\"ppx_blob\"\ndescription=\"Include a file as a string at
compile
time\"\nversion=\"0.1\"\nrequires=\"ppx_tools\"\nppx=\"./ppx_blob\"\n"
The example that comes with ppx_blob is the little quine:
print_string [%blob "quine.ml"]
Thanks,
John Whitington
reply other threads:[~2014-10-11 20:00 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=54398C4F.4020707@coherentgraphics.co.uk \
--to=john@coherentgraphics.co.uk \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox