Hello
Here is the latest Caml Weekly News, for the week of July 03 to 10, 2012.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-07/msg00032.html
Aaron Bohannon announced:One thing that is missing from the OCaml top level loop is line editing features. I used to use a wrapper program called "ledit" that added readline support, but I never seem to have it installed on my machine when I need it, and moreover, I have started to get used to the more flexible line editing of zsh. After some poking around, I found that it's fairly straightforward to wrap any REPL with a zsh script and get zsh line editing capabilities, which includes multi-line support (e.g., so you can fix a typo you made three lines back). I'm attaching the script I hacked together, in case it is useful to anyone else. It works great for me, but it was not written to be generic and robust, so YMMV. You must use ctrl-D to exit cleanly -- I didn't bother adding support for "#quit". I'm sure someone could make many improvements to it if they had more patience for zsh scripting than I do. (Find the file at the archive link above.)Markus Weißmann suggested:
rlwrap? [1] Its probably already available through your favorite package manger. -Markus [1] http://utopia.knoware.nl/~hlub/uck/rlwrap/rixed added:
Interesting, although rlwrap gives you history, filename completion, prompt coloring, syntax completion, brackets matching, use of an external editor and easy configuration via .inputrc. For instance I have this in my .zshrc: alias ocaml='rlwrap --prompt-colour=green --multi-line --remember --complete-filenames --command-name=ocaml ocaml -rectypes' And this in my .inputrc: $if ocaml "\C-o": "()\C-b" "\C-n": ";;\n" $endif While the default C-^ launches vi (for multi-line edits)
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-07/msg00039.html
Jean-Christophe Filliâtre announced:This is our pleasure to announce the first release of ReML, an OCaml library for combinatorics. This library provides the following modules: - Dlx: Knuth's dancing links - Zdd: Zero-suppressed binary decision diagrams - Emc: a common interface to modules Dlx and Zdd to solve the Exact Matrix Cover problem - Tiling: converts a 2D tiling problem into an EMC problem Documentation: http://www.lri.fr/~filliatr/reml/doc/index.html ReML also contains an interpreter for a language to describe 2D tiling problems (such as Pentominos) and to solve them or to enumerate their solutions. The source tarball contains some examples. Web page: http://www.lri.fr/~filliatr/reml/
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-07/msg00040.html
Alessandro Strada announced:I'm developing a FUSE filesystem over Google Drive using ocamlfuse. The project is hosted on OCaml Forge (https://forge.ocamlcore.org/projects/gdfuse/) and on github (https://github.com/astrada/google-drive-ocamlfuse). I've also uploaded the package on oasis-db (http://oasis.ocamlcore.org/dev/view/google-drive-ocamlfuse/latest). In this pre-release, I've implemented enough FUSE operations to provide a read-only access to the files stored on Google Drive. Before implementing the write operations, I would like to have some feedback from real users to see if someone finds this project useful and to check if my implementation is working. I've set up a mailing list on the forge (https://lists.forge.ocamlcore.org/cgi-bin/listinfo/gdfuse-devel) where you can post questions, suggestions or report problems. Or, if you want, you can open issues on github. Before trying this application, please read the wiki pages containing info about authorization (https://github.com/astrada/google-drive-ocamlfuse/wiki/Authorization) and configuration (https://github.com/astrada/google-drive-ocamlfuse/wiki/Configuration).Goswin von Brederlow suggested:
You can use my fuse bindings for ocaml: http://anonscm.debian.org/gitweb/?p=pkg-ocaml-maint/packages/libfuse-ocaml.git;a=summary
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-07/msg00042.html
Andrej Bauer asked and Gabriel Scherer replied:> If I wanted a parser in Ocaml that can parse things in the style of > Agda (with the cool underscore thingy), where would I start looking? My advice would be to mimic Agda's conceptual two-pass process: parse only the static Context-Free Language structure of your language, parsing "expressions" (or any syntactic class that admits mixfixes) into just a list of non-terminals (plus parenthesing, if you assume your mixfixes are all well-balanced wrt. symmetric delimitors). This can be done easily with existing OCaml parser or parser generator technology (menhir). Then, in a later pass, you compute mixfix definitions/scopes and add this structure to the parsetree, using a custom algorithm that has been described in the Agda literature (or non-Agda previous work), eg. http://www.cse.chalmers.se/~nad/publications/danielsson-norell-mixfix.html . This is a clean way to handle this and, I believe, one of the simplest to use, understand and debug.Jérémie Dimino also suggested:
You can have a look at dypgen [1]. Actions can extend the grammar. [1] http://dypgen.free.fr/
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-07/msg00043.html
Damien Doligez announced:We are in the last stages of fixing bugs before 4.00.0 is released. If your favorite bug report is still open and you want to know whether we will fix it before 4.00.0, look at its "Target Version" field. If this is 4.00.0+dev, we are trying hard to fix your bug. If it is not and you want to insist that we fix your bug before the release, just drop me a note. I'm not making any promise, but we will carefully review your bug before taking a decision.
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-07/msg00056.html
Nicolas Ojeda Bar asked and Gabriel Scherer replied:> Is there a clean way to use stream parsers/lexers if I want to have > location (line number, character position) information attached to > each token? Indeed: you need your lexer to produce location information. Instead of manipulating a (token Stream.t), you will produce (and then parse at the lexer level) a ((token * location) Stream.t). This is the way Camlp4 parsers are implemented (recursive descent over a stream of tokens and positions). See also "Planck", an experiment at combinator parser libraries by Jun Furuse, using a similar (but different) architecture. http://bluestorm.info/camlp4/camlp4-doc/Sig.Lexer.html https://bitbucket.org/camlspotter/planck/ http://camlspotter.blogspot.fr/2011/05/planck-small-parser-combinator-library.html
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-07/msg00058.html
Nicolas Ojeda Bar asked and Gabriel Scherer replied:> Is it possible to use Camlp4 to write pretty printers of arbitrary > data? The signature Camlp4.Sig.Printer seems to indicate the pretty > printing facility only works with OCaml ASTs... > > On the other hand, with Camlp5 it is possible to write pretty > printers for arbitrary ASTs > (see http://pauillac.inria.fr/~ddr/camlp5/doc/html/printers.html), > so I imagine there must be a way to do the same thing with Camlp4... As far as I know, no such facility exists in Camlp4. Note however that there is quite a difference between parsers and printers. Supporting extensible parsing is very difficult, because parsing is quite a complex process. On the contrary, "printers" as presented here or as implemented in Camlp4 are more like regular tree traversals, calling a pretty-printing library that takes care of the visual formatting aspects. An "extensible printer" can therefore be summarized as an extensible tree traversal, something that is not too difficult to achieve with a decent software architecture; for example Camlp4's MapGenerator framework. If you don't need the "extensible" parts of Camlp5 printer's support, because your datatype to print is fixed, you can use the pretty-printing library directly. Camlp4 uses the Format module of the standard library, but I personally found it to be a bit painful to use, and have a preference for the Pprint library of François Pottier: http://gallium.inria.fr/~fpottier/pprint/pprint.tar.gz (There are other pretty-printing libraries for OCaml that I haven't tried, such as Martin Jambon's easy-format: http://mjambon.com/easy-format.html ) My advice would be to use one of those pretty-printing libraries, to see if it fits your bill, or if you really need another abstraction layer such as Camlp5 printers. (Of course you can also use Camlp5 directly if it solves you problem.)
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-07/msg00066.html
Dario Teixeira announced:The registration of users with login + password is a common feature in web sites. And as you know, this login data is a valuable prize for attackers. Therefore I'm happy to announce the availability of version 1.0 of OCaml-safepass, a simple library offering facilities for the safe storage of user passwords. By "safe" I mean that passwords are salted and hashed using the Bcrypt algorithm [1]. Salting prevents rainbow-table based attacks [2], whereas hashing by a very time-consuming algorithm such as Bcrypt renders brute-force password cracking impractical. OCaml-safepass's obvious usage domain are web applications, though it does not depend on any particular framework. Internally, OCaml-safepass binds to the C routines from Openwall's Crypt_blowfish [3]. However, it would be incorrect to describe OCaml-safepass as an OCaml binding to Crypt_blowfish, because the API it exposes is higher-level and more compact than that offered by Crypt_blowfish. Moreover, OCaml-safepass's API takes advantage of OCaml's type-system to make usage mistakes nearly impossible. Here is the project website: http://ocaml-safepass.forge.ocamlcore.org/ The API documentation is also available on online: http://ocaml-safepass.forge.ocamlcore.org/apidoc/index.html Feedback is more than welcome! Best regards, Dario Teixeira [1] http://en.wikipedia.org/wiki/Bcrypt [2] http://en.wikipedia.org/wiki/Rainbow_table [3] http://www.openwall.com/crypt/
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2012-07/msg00069.html
Dash, Santanu asked and Jérémie Dimino replied:> I work in the area of program analysis. I am currently trying to analyse > Ocaml programs and wish to output file-specific information with the aid of > the Ocaml compiler. > > For example, if I compile a file called foo.ml, i want to output a file > called foo.info based on an analysis of alpha.ml. I have already integrated > the analysis module with the Ocaml compiler. > > Can someone direct me on the best way to go about this? Is there a variable > in the compiler that stores the filename of the file currently being compiled? There is Location.input_name. It is set by the compiler before parsing a source file (file "driver/pparse.ml", function "file"). Note that if there are multiple source files on the command line it will be modified for each one of them.
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/. Existential Crisis: http://alaska-kamtchatka.blogspot.com/2012/07/existential-crisis.html Half-hearted hash table: http://gallium.inria.fr/~scherer/gagallium/half-hearted-hash-table/index.html PG'OCaml 1.6 released: https://forge.ocamlcore.org/forum/forum.php?forum_id=845 Opa 1.0.4 Released: http://blog.opalang.org/2012/07/opa-104-released.html Major change soon...: https://forge.ocamlcore.org/forum/forum.php?forum_id=844
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.