Hello
Here is the latest Caml Weekly News, for the week of April 06 to 13, 2010.
Dedicated to Albertine, born on April 11.
Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/8d93b0bf3340728a#
Sylvain Le Gall announced:OASIS ----- This is the first public release of OASIS. It aims to provide a clean and efficient way to create a configure/build and install system for your OCaml applications and libraries using a single '_oasis' file. It is inspired by Haskell's Cabal. Features: * generate a standalone setup.ml which provides standard entry points in * the build system, * plugin system that allows to choose the best sub-system: OCamlbuild, * custom build (Makefile based)... * the file _oasis can be used as a metadata storage to help other tools * analyze your source code * customization of every piece of the generated build system by just * editing the files concerned * full OCaml script, no Unix call involved * tested on Linux and Windows Bonus features: * available in french, using ocaml-gettext * binary installers for Linux and Windows (32bits) Website: http://oasis.forge.ocamlcore.org If you want to contribute: http://oasis.forge.ocamlcore.org/contribute.html ocamlify && ocaml-data-notation ------------------------------- These two tools are needed to build OASIS. They are released in separate projects because I use it elsewhere and they are just pre-requisites of OASIS. ocamlify helps to include files as OCaml code. The beginning of a build rule can be copy-and-pasted from OASIS myocamlbuild.ml. http://darcs.ocamlcore.org/cgi-bin/darcsweb.cgi?r=oasis;a=headblob;f=/myocamlbuild.ml ocaml-data-notation, aka odn, dumps OCaml data in OCaml notation. It is inspired by JSON. It uses type-conv to create data dumper functions, you just have to add "with odn" in the type definition. There is no load scheme, since it is used to dump datastructure into OCaml scripts. It is mainly a code generator helper.
Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/086f66fc0f2ce203#
Thorsten Ohl asked:for ages, I've been using the following (somewhat hackish) approach to pretty printing source code that requires special lexical markers to allow statements that continue over more than one line. (e.g. in Fortran foo = 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 & + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 & + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 & + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 & + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 + 1 & + 1 + 1 + 1 + 1 + 1 + 1 + 1 and in /bin/sh we have the same with "\\" instead of "&"): open Format;; let continuing = ref true;; let wrap_newline () = let out, flush, newline, space = get_all_formatter_output_functions () in let newline' () = if !continuing then out " &" 0 2; newline () in set_all_formatter_output_functions out flush newline' space;; let nl () = continuing := false; print_newline (); continuing := true;; let _ = wrap_newline ();; (* Nonsensical example: *) for statement = 1 to 3 do printf " @[<2>foo = 1"; for i = 1 to 100 do printf "@, + 1" done; nl () done;; The requirement to end each statement with "nl ()" is tedious in real world applications and the use of the global variable "continuing" violates my sense of aesthetics... Is there a more idiomatic approach that I'm missing?Martin Jambon then suggested:
Given the imperative nature of the Format module interface, your solution seems right to me. Maybe you'll output up to 2 bytes beyond the margin but I guess that's ok. You may also consider using easy-format, which offers a functional interface on top of Format. The programmer's job is to create a tree containing strings and parameters while the actual printing is done by a single function call. That said, easy-format does not support custom newline strings although I could add the feature. Link: http://martin.jambon.free.fr/easy-format.html
Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/bc984fb6ce80a94f#
Oliver Bandel asked and Dario Teixeira replied:> where can I find the documenatation to pcre-ocaml? > Some pages seem to be out dated. > Where can I find the docs? The Ocaml library is essentially a very thin wrapper around the original C library. Therefore, all your documentation needs should be satisfied by the original docs available at www.pcre.org. I've used PCRE extensively, and still haven't found one issue that wasn't covered in those docs...Sebastien Mondet suggested:
For the ocaml part, I found this: http://www.janestreet.com/ocaml/janestreet-ocamldocs/pcre/index.html and this: http://hg.ocaml.info/release/pcre-ocaml/file/8393f8f80c40/lib/pcre.mli still quite useful.Stefano Zacchiroli then said:
FWIW, in Debian (and derivatives) packages, ocamldoc API references are consistently generated and made available under /usr/share/doc/PKGNAME/html/api/, and also registered with doc-base. Hence, you can usually browse all the HTML API references of installed OCaml libraries with tools like dwww at http://localhost/dwww/menu/sprogramming_ocaml.html PCRE is no exception (PKGNAME = libpcre-ocaml-dev), even though it was affected by http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=570717 , which got fixed a few minutes ago.
Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/b6885aff288482f9#
Jacques Carette asked:I need to be able to lex/parse and pretty-print unicode with caml. I am aware of several 'solutions' for each part, but I would choose to use whatever library seamlessly allows me to both parse and build pretty-printers for unicode-based input. For example, it is unclear to me that module Print in Batteries integrates well with UTF8.t - but that could just be a documentation issue. Camomile seems to be good for the representation part, but does not seem to offer lex/parse and pretty-print modules. It seems like ulex + dypgen works for the front-end part. Back-end? [It's not clear to me that ulex + menhir works]Dario Teixeira replied:
I can confirm that at least with a recent Menhir, you can use whichever lexer you want, even Ulex. In fact, I have used the Ulex+Menhir combination in a couple of my own projects, and their source-code is available if you want to check out how it's done: https://forge.ocamlcore.org/scm/viewvc.php/trunk/ccss/src/ccss.ml?root=ccss https://forge.ocamlcore.org/scm/viewvc.php/trunk/lambdoc/src/lib/lambdoc_read_lambtex/main.ml?root=lambdocFrançois Pottier also replied:
> [It's not clear to me that ulex + menhir works] Yes, it does. This is documented in the FAQ near the end of the Menhir reference manual. In short, although Menhir (like ocamlyacc) produces code whose interface suggests that it is meant to be used with an ocamllex-generated lexer, this interface can be easily adapted. Wrappers for this purpose are provided as part of MenhirLib.
Thanks to Alp Mestan, we now include in the Caml Weekly News the links to the recent posts from the ocamlcore planet blog at http://planet.ocamlcore.org/. Someone’s feedback on OCaml: http://www.wisdomandwonder.com/link/4695/someones-feedback-on-ocaml Yojson: https://forge.ocamlcore.org/projects/yojson/ OASIS 0.1.0 first public release: http://forge.ocamlcore.org/forum/forum.php?forum_id=574
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.