Previous week Up Next week


Here is the latest Caml Weekly News, for the week of June 02 to 09, 2009.

  1. OCaml/Sqlite ORM layer (preview 0.2)
  2. Probabilistic programming in OCaml
  3. OCaml 3.11.1+rc1
  4. ML 2009 Call for Demos
  5. Which types for representing HTML documents ?
  6. Other Caml News

OCaml/Sqlite ORM layer (preview 0.2)


Anil Madhavapeddy announced:
I've been using OCaml in a few server projects which need a light- 
weight database, and so I wrote a library to map OCaml objects  
directly to a SQLite3 backend database.

Like other ORM systems, you define a schema based on sets of named  
fields.  The Sql_orm library then generates an OCaml module and  
interface with static accessor methods which take care of all the  
tedious SQL interactions and provide you with a nice high-level,  
statically type-safe access method.

It's still early days but the library is very functional and stable.   
I've put up docs and instructions at:

It's currently written as a module which outputs OCaml directly, and  
once I'm happy with the feature-set, I intend to port it to use camlp4  
so that schemas can be declared directly without the need to  
regenerate a separate ML file.

You can view an example schema at:
- declares the fields
- uses it
- my_db.* are the generated files.
- the tests/ directory has more advanced usage, such as foreign keys  
and so on.

Probabilistic programming in OCaml


Continuing the thread from last week, Eliot Handelman asked and Oleg replied:
> This looks really interesting,. but can it be compiled with 3.10.1?
> First bash at compiling the delimcc library failed.

Yes, the library can be used with 3.10.1 and even 3.09. I think I know
what problem you have encountered. Ideally, to compile delimcc you
need the configured OCaml sources, because delimcc needs a few header
files that are not normally installed. Since one could install OCaml
from a binary distribution, the sources are not necessarily
available. Therefore, delimcc includes the needed header files as part
of its distribution, for the most common platform: ia32 and
Linux/BSD. Alas, these files differ slightly among OCaml versions
(e.g., because of renaming). Therefore, delimcc distribution includes
two sets of files, in the directories ocaml-byterun-3.09 and
ocaml-byterun-3.10. With OCaml 3.10.1, one has to use
ocaml-byterun-3.09 files rather than ocaml-byterun-3.10. Sorry, this
is indeed confusing.

Thus, you may want to edit the Makefile in delimcc, comment out the
and uncomment the line above that contains 3.09. I think it would
build delimcc library (please `make testd0' to make sure).

OCaml 3.11.1+rc1


Damien Doligez announced:
We fixed a few bugs from OCaml 3.11.1+rc0, and prepared a new release  
The main changes from rc0 are the following.

- PR#4796: ocamlyacc: missing NUL termination of string
- PR#4798: compilation of ocamldoc.opt fails under windows
- PR#4804: bug in Big_int.int64_of_big_int on 32-bit platforms.
- PR#4805: improving compatibility with the clang C compiler
- PR#4809: issue with Unix.create_process under Win32

The changes from 3.11.0 are listed at the end of this mail.

If you haven't tested rc0, or if you had a problem with one of the above
bugs, please test rc1 now and send me some feedback.  This release
candidate is available in source code at

We seem to have a small problem remaining in build/  It  
will be
fixed for the release.

Happy hacking,

-- Damien for the OCaml team

Objective Caml 3.11.1:

Bug fixes:
- PR#4095: ocamldebug: strange behaviour of control-C
- PR#4403: ocamldebug: improved handling of packed modules
- PR#4650: Str.regexp_case_fold mis-handling complemented character  
sets [^a]
- PR#4660: Scanf.format_from_string: handling of double quote
- PR#4666: Unix.exec* failure in multithread programs under MacOS X  
and FreeBSD
- PR#4667: debugger out of sync with dynlink changes
- PR#4678: random "out of memory" error with systhreads
- PR#4690: issue with dynamic loading under MacOS 10.5
- PR#4692: wrong error message with options -i and -pack passed to  
- PR#4699: in otherlibs/dbm, fixed construction of
- PR#4704: error in caml_modify_generational_global_root()
- PR#4708: (ocamldoc) improved printing of infix identifiers such as  
- PR#4722: typo in configure script
- PR#4729: documented the fact that PF_INET6 is not available on all  
- PR#4730: incorrect typing involving abbreviation "type 'a t = 'a"
- PR#4731: incorrect quoting of arguments passed to the assembler on  
- PR#4735: Unix.LargeFile.fstat cannot report size over 32bits on Win32
- PR#4740: guard against possible processor error in
- PR#4745: type inference wrongly produced non-generalizable type  
- PR#4749: better pipe size for win32unix
- PR#4756: printf: no error reported for wrong format '%_s'
- PR#4758: scanf: handling of \<newline> by format '%S'
- PR#4766: incorrect simplification of some type abbreviations.
- PR#4768: printf: %F does not respect width and precision  
- PR#4769: Format.bprintf fails to flush
- PR#4775: fatal error Ctype.Unify during module type-checking  
(temporary fix)
- PR#4776: bad interaction between exceptions and classes
- PR#4780: labltk build problem under Windows.
- PR#4790: under Windows, map ERROR_NO_DATA Win32 error to EPIPE Unix  
- PR#4792: bug in Big_int.big_int_of_int64 on 32-bit platforms.
- PR#4796: ocamlyacc: missing NUL termination of string
- PR#4804: bug in Big_int.int64_of_big_int on 32-bit platforms.
- PR#4805: improving compatibility with the clang C compiler
- PR#4809: issue with Unix.create_process under Win32
- Module Parsing: improved computation of locations when an ocamlyacc  
                   starts with an empty nonterminal
- Type-checker: fixed wrong variance computation for private types
- x86-32 code generator, MSVC port: wrong "fld" instruction generated.
- ocamlbuild: incorrectly using the compile-time value of $OCAMLLIB
- Makefile problem when configured with -no-shared-libs
- ocamldoc: use dynamic loading in native code

Other changes:
- Improved wording of various error messages
   (contributed by Jonathan Davies, Citrix).
- Support for 64-bit mode in Solaris/x86 (PR#4670).
Richard Jones then said:
I built this for Fedora:

Not really tested it very much beyond running a few scripts in the

ML 2009 Call for Demos


Andreas Rossberg announced:
                           CALL FOR DEMOS

                    2009 ACM SIGPLAN Workshop on ML

               To be held in conjunction with ICFP 2009
                      on Sunday, August 30, 2009
                      in Edinburgh, Scotland, UK


Have you written a fancy tool or library that may ease the life of
fellow ML programmers? Have you developed interesting software using
your favorite dialect of ML? Or have been producing some cool ML code
lately that you just want to show off in action?

Now is your chance to demonstrate it to the world. This year's ML
Workshop will feature a session for presenting running code written
in ML, or written for ML. We seek 10-15 minute live demos or tutorials
related to ML technology that show new developments, interesting
prototypes, or work in progress.

The 2009 Workshop on ML will be held in conjunction with the 14th ACM
SIGPLAN International Conference on Functional Programming (ICFP 2009)
in Edinburgh, Scotland, UK.


Demo Submission: Sunday, June 28, 2009
Notification:    Friday, July 10, 2009
Workshop:        Sunday, August 30, 2009


Please submit an abstract, about half a page long, describing the demo
and its technical content. Be sure to include the demo's title, authors,
collaborators, references and acknowledgements. If you have a project
website we encourage you to also provide a link that we can put up on
the ML Workshop home page once your demo is accepted.

Your demonstration should take 10-15 minutes. The exact length per demo
will be decided based on the number of accepted submissions. Please notice
that you will have to bring all hardware and software required for your
demo yourself -- all the workshop organizers can provide is a projector.

Please send submissions (in PDF format) with your complete contact
information via email to by June 28, 2009. Please
feel free to also contact this address if you have further questions.


Andreas Rossberg         (Max Planck Institute for Software Systems)


Umut Acar                (Toyota Technological Institute at Chicago)
Damien Doligez           (INRIA Paris-Rocquencourt)
Neal Glew                (Intel)
Andrew Gordon            (Microsoft Research Cambridge)
Patricia Johann          (University of Strathclyde)
Oleg Kiselyov            (FNMOC)
Neelakantan Krishnaswami (Carnegie Mellon University)
David MacQueen           (University of Chicago)
Yasuhiko Minamide        (University of Tsukuba)
Norman Ramsey            (Tufts University)


See the ML Workshop series home page at:

Which types for representing HTML documents ?


Sébastien Hinderer asked and Gabriel Kerneis replied:
> According to you, how could an HTML document best be represented in
> OCaml ?

The whole website is worth reading if you're interested in web
programing using Ocaml.
Richard Jones also replied:
CDuce is worth considering:
Martin Jambon also replied:
Ocamlnet's Nethtml works fine for parsing:

type document =
    Element of
      (string * (string * string) list *
       Nethtml.document list)
  | Data of string

If your goal is to interpret arbitrary web pages, you have to allow all kinds
of standard or non-standard elements and attributes anywhere in the document.

If you are creating HTML documents, beware that you can't embed Flash objects
using standard HTML.  I'm not even speaking of javascript happily manipulating
the DOM tree with little restrictions.

Personally I use text templates and validate web pages once they are in my
browser (using the shortcut to that opera provides).  For
javascript-generated nodes, I just check that it works in various browsers
(the firefox "View source chart" extension is useful for debugging the DOM tree).

I do not suffer at all from the absence of static type-checking of the HTML
tree.  I imagine that the reasons for this are:

* HTML is the final product and is trivial to debug (no need to printf
everything since everything is already printed...)

* There are no complicated conditionals that would leave certain parts of the
code untested for a long time.

* Mainstream web browsers are very tolerant.  Small accidental deviations from
the strict W3C standards usually have no visible effect.

Other Caml News

From the ocamlcore planet blog:
Thanks to Alp Mestan, we now include in the Caml Weekly News the links to the
recent posts from the ocamlcore planet blog at

DJ mix using liquidsoap:


Mise en boîte:

Euler's Power Riffs:

Immutability Redux:

Jim Henson Co.:


Another Quick Shot of the Desktop Product:

ocaml-orm-sqlite 0.2:

The Battle For Your Address Book:

Old cwn

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe online.

Alan Schmitt