Previous week Up Next week

Hello

Here is the latest Caml Weekly News, for the week of June 27 to July 04, 2006.

My son, Augustin, turns 5 today. Happy Birthday Augustin!

  1. Esterel Technologies is looking for a Caml Engineer
  2. Marshalling data format deteriorates compressibility
  3. RASCL's A Simple Configuration Language
  4. XStream: streaming XML transformation
  5. Numerix-0.22
  6. Bindings for SDL and OpenGL 2.0 plus extensions
  7. Which development framework for web application in OCaml?
  8. Question on Variant Types
  9. Type from local module would escape its scope?
  10. Camomile 0.6.6
  11. Sentence Segmenter

Esterel Technologies is looking for a Caml Engineer

Amandine ROY announced:
I am Amandine ROY, HR Manager of Esterel Technologies (international company of 140 employees). 
http://www.esterel-technologies.com 
We develop software solutions for critical embedded software development that enable to capture, communicate and automatically implement completely unambiguous software specifications. 
Actually, I am looking for one engineer, within our R&D Department, who will participate in the development of a tool that make structural code coverage (MCDC) for CAML programs. 
This job is located in Elancout (near Paris) or in Toulouse. 
You will find the job description on our web site: 
http://www.esterel-technologies.com/company/jobs/france-elancourt.html

If you or one of your connexions is interested , do not hesitate to contact me. 

Best regards, 

Amandine ROY
Human Resources Manager 
amandine.roy@esterel-technologies.com
ESTEREL TECHNOLOGIES
Phone: +33 1 30 68 61 74 - Fax: +33 1 30 68 61 61
http://www.esterel-technologies.com
      

Marshalling data format deteriorates compressibility

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/2a504af427dee5f2/fa72716dc7be20b3#fa72716dc7be20b3

Markus Mottl announced:
I have just finished (and attached) a patch for the latest CVS-release 
of OCaml, which adds a new marshalling flag.  This flag generates a 
different marshalling format, which uses absolute addresses to refer 
to shared values.  This fixes the problem of bad compressibility of 
marshalled OCaml data.  See the patch header for more information. 

Since the patch is quite small and does not break any existing code, 
we'd be very grateful if it could be made part of the next 
OCaml-release.  I'll also enter the patch into the OCaml bugtracker so 
that people running into the same problem can find it there, too. 

(See the archive for the attachment.)
      

RASCL's A Simple Configuration Language

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/05c8331ea6f3d74e/5519216d4774a054#5519216d4774a054

Matt Gushee announced:
Here's yet another configuration language--with an OCaml library to 
process it, of course. 
RASCL came into being after I investigated the Config_file library and 
found it overly complex--which may say more about me than about the 
library. But at any rate, RASCL, the language, and Rascl, the OCaml 
library attempt to be about as simple as possible for both users and 
developers, at the expense of some generality. 

Here are some of the main features: 

* A RASCL file may be just a sequence of keys and values, or it may 
   be arbitrarily nested. 
* Values may be strings, integers, floats, booleans, or lists thereof. 
* No OCaml-specific types supported (that's a feature, not a bug ;-) 
* Strings need not be quoted unless they contain special characters 
   or would otherwise be parsed as another type. 
* Two interfaces for accessing configs: 
   - Dict module 
   - Object system, with a CamlP4 preprocessor to generate objects 
     and sample config files 

BTW, I have attempted to provide thorough documentation for the language 
RASCL--in case anyone wants to implement it for other programming 
languages. However, I don't have a lot of experience writing language 
specifications, and there are probably some errors and ambiguities. I'd 
appreciate feedback from any interested and knowledgeable parties. 

RASCL and Rascl may be found at:  http://matt.gushee.net/rascl/ 
      

XStream: streaming XML transformation

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/8a2433ad0dcea835/9289436eccb63c8d#9289436eccb63c8d

Alain Frisch announced:
This is to announce the first public release of XStream, a simple 
programming language for XML. Transformations written in XStream are 
compiled into efficient XML stream processors: the output is computed 
and produced while the input is being parsed, which makes it possible to 
run some transformations on very big XML documents which could not even 
fit in memory. 

Though XStream is mostly intended as a back-end for higher-level 
languages, it is also possible to use it directly. The language 
features ML-like pattern matching and higher-order functions, but no types. 

Here's how XStream relates to OCaml: the compiler is written in OCaml 
and uses OCaml as a back-end to produce efficient native code. Moreover, 
XStream programs can embed OCaml code and manipulate OCaml values 
(useful to deal with non-XML data). 

Web-site: http://yquem.inria.fr/~frisch/xstream 
      
David MENTRE asked and Alain Frisch answered:
> It seems obvious but I want to be sure: can XStream generated code be 
> embedded in OCaml programs (native and bytecode)? 

Currently, XStream generates only a fully functional executable 
transformaion which reads its input from an XML file and send its output 
to the standard output. 
It would be quite simple to have it generate an OCaml module which 
exports a ``filter'' function (a transformer of XML event streams) if 
there is some demand for such a feature. 

> How XStream compares to OCamlDuce? 

OCamlDuce is intended to write large OCaml applications which need to 
manipulate XML data. XStream is really meant as an XML transformation 
tool. In particular, to achieve efficient streaming, XStream keeps 
control over the evaluation of the transformation as a whole. OCamlDuce, 
instead, relies on the regular OCaml evaluation mechanism. 
> So XStream cannot be used as a replacement to 
> OCamlDuce. Is it correct? 

Yes it is. 
      
Richard Jones asked and Alain Frisch answered:
> I downloaded the tarball and looked at 
> the examples and I can't tell: can XStream transform an XML file into 
> something else? 
> In particular we have a requirement to convert a huge XML file into 
> tabular CSV data on the fly (while the XML is being downloaded).  The 
> XML file just consists of a very large number of <row>...</row> 
> records. 


That's possible with XStream: text is just a special case of XML. 
For instance, the following script extracts the stream of text from the 
input XML stream. 
main(_[x1] x2) -> concat(main(x1),main(x2)) 
main(%s x) -> %s main(x) 
main(()) -> () 
      

Numerix-0.22

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/8ea6dc93783aa80a/d9753f86a3239c92#d9753f86a3239c92

Michel Quercia announced:
It is my pleasure to announce the release of the new version of the 
Numerix library (version 0.22). 

Numerix is a multiprecision library providing operations on integers of 
arbitrary length; it is interfaced with the following programming 
languages : Caml-light, Objective-Caml, C and Pascal. Concerning the 
speed, it is as fast as the GNU-MP library, and may even be faster 
(depending on the architecture and the size of the numbers to be computed 
). 

This new version includes, among other improvements : 

-- assembly code for the x86-64, the Dec-alpha, and the Power-PC-32 
processors. 
-- the possibility to compile Numerix on Windows Computers, with the 
help of one of the Cygwin or Msys environnements. 

Download : 
http://pauillac.inria.fr/~quercia/cdrom/bibs/numerix.tar.gz 

Documentation : 
http://pauillac.inria.fr/~quercia/cdrom/bibs/numerix-eng.pdf 
      

Bindings for SDL and OpenGL 2.0 plus extensions

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/0734582cf1ab0655/17080096249f42c1#17080096249f42c1

Elliott Oti announced:
In the interests of reinventing the wheel where possible, I wrote OCaml 
bindings for the SDL libraries and OpenGL libraries over a couple of 
weekends. 
The (automatically generated) OpenGL bindings cover OpenGL 1.1, 1.2, 
1.3, 1.4, 1.5, 2.0 and most current non-platform-specific extensions. 
There are no dependencies whatsoever: the system opengl shared library 
is loaded dynamically, and the functions are called dynamically, so 
there is no need to link against import libraries. 

The SDL bindings are fairly but not wholly complete; they are 
hand-written and functions are bound on an as-needed-by me basis. They 
are only dependent on the SDL main library and not on the mixer, ttf or 
image libraries. Because I wanted to have basic sound capabilities, the 
SDL_Audio modules are implemented, along with extra functions for 
panning and pitch shifting audio buffers. 

In addition there are functions written in OCaml to load uncompressed 
and RLE-encoded TGA files, scale bitmaps with different filters 
(currently, only box, tent and lanczos3 filters are implemented), 
generate mip-maps suitable for usage in OpenGL, and a complete port 
from C to OCaml of the SFont bitmapped text library. 

This is very much a work-in-progress, and is currently at version 0.1. 
It has been tested on Windows 2000, Windows XP, and Ubuntu Linux on 
AMD64. It compiles as-is with the mingw port of OCaml 3.09 and on 
Linux. It has not been tested on any other platform. There are around 
20 example files. SDLCaml and GLCaml are being written primarily for my 
personal needs but are being released in the hope that someone finds 
them useful. Feedback is welcome. 

SDLCaml and GLCaml are released under the LGPL, version 2. 

Main site: http://www.elliottoti.com/index.php?p=15 

Gzipped source tarball: 
http://www.elliottoti.com/code/gfx/glcaml.0.1.tar.gz 

Documentation: http://www.elliottoti.com/code/gfx/doc 
      

Which development framework for web application in OCaml?

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/47e3244b5bd1c2d1/ed3e35a9815c49e2#ed3e35a9815c49e2

A week ago, David MENTRE asked:
For my demexp server, I'm considering the development of a web 
interface, accessible from a simple web browser. I have standard 
requirements (html forms) as well as "advanced" ones (would like to 
support AJAX-like things, navigation in tree data structures, etc.). 
Which development frameworks are available to do such things in OCaml? 
I'm looking for frameworks under a license compatible with GNU GPL. 

Right now, I know about: 
 - WDialog 
 - XCaml 

For low level stuff (basic CGI interface), there is also OCamlNet. 

I've made some experiments with WDialog but I'm not entirely convinced 
by its approach of separating interface description from event 
handling code. Moreover it lacks some features that would be useful 
for us : i18n support (even if, thanks to Gerd, a preliminary code is 
available in CVS tree), advanced widgets (tree structures), AJAX 
support, etc. 

What other people are using to do web stuff? Is everybody using PHP? ;-) 

Any recommandation on building such complex web interface with 
available OCaml software? 

Best regards, 
david 

PS : My current demexp server is an autonomous Unix daemon, written in 
OCaml, accessible through ONC RPC calls over a TCP socket. Until know, 
I have made a simple CGI that access the demexp server. But I'm 
considering merging the server part with the web part. Has somebody 
some knowledge on the design of web architecture and recommendation or 
pointer to relevant litterature? 
      
Editor's note:
There have been many new replies to this thread. You may read them at the
archive link above.
      

Question on Variant Types

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/88aedcd1af43b291/d35b3a582cbf3294#d35b3a582cbf3294

Jonathan Roewen asked and Chris King answered:
> I seem to be running into the problem of not being able to coerce 
> polymorphic abstract types that use variants. 
> 
> Eg: 
> 
> type 'a t;; 
> type x = [ `Foo ];; 
> type y = [ `Bar | x ];; 

> let widen x = (x : x t :> y t);; 

> Gives: 
> Type x t is not a subtype of type y t 
> Type x = [ `Foo ] is not compatible with type y = [ `Bar | `Foo ] 
> The first variant type does not allow tag(s) `Bar 

> Yet the above approach works fine for non-abstract types. 

You need to explicitly specify the variance of 'a t: 
type +'a t;; 

This tells the type system that t is covariant with respect to 'a: if 
x is a subtype of y, then x t is a subtype of y t.  Not all compound 
types share this property (most notably, mutable structures are 
invariant and function arguments are contravariant) so O'Caml must 
assume all abstract types to be invariant unless it's told otherwise. 
      

Type from local module would escape its scope?

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/ccbcaf21b44fed78/3c71209f4969c4dc#3c71209f4969c4dc

Bruno De Fraine asked and Virgile Prevosto answered:
> I don't quite understand this behavior regarding local modules (in   
> OCaml 3.09.2): 
> 
> The following is accepted: 
> 
> module type FOO = 
> sig 
>    type t 
>    val value : t 
> end ;; 
> 
> let foo () = 
>    let module Foo : FOO = 
>    struct 
>      type t = int 
>      let value = 1 
>    end in 
>    ignore Foo.value 
> ;; 
> 
> While the following is rejected: 
> 
> let foo (ignore: 'a -> unit) = 
>    let module Foo : FOO = 
>    struct 
>      type t = int 
>      let value = 1 
>    end in 
>    ignore Foo.value 
> ;; 
> 
> With an error on the expression "Foo.value" stating that "The type   
> constructor Foo.t would escape its scope". Reading about the typical   
> case for this error message in
> http://caml.inria.fr/pub/ml-archives/caml-list/2002/10/0cf087feab3ef8dc5ccba5a8592472fb.en.html
> didn't   
> really help me. Why does it make a difference whether ignore is an   
> argument? 

Because "'a -> unit" does not mean the same thing in both cases. In the 
case of Pervasives.ignore, it is a type scheme which denotes all the 
types you can obtain by instantiating 'a. On the contrary, when used as 
a type annotation to your argument, "'a -> unit" only tells ocaml that 
there exists an 'a such that the argument ignore has this type: you can 
see that with the following code: 
# let foo (ignore: 'a -> unit) = ignore 1;; 
val foo : (int -> unit) -> unit = <fun> 

where 'a is instantiated by int in the inferred type. 

IIRC arguments can not have a generalized type of the form 
"forall 'a, 'a -> unit", but methods and record fields support such 
types: for instance, you can have: 

# module type FOO = 
sig 
   type t 
   val value : t 
end ;; 
        module type FOO = sig type t val value : t end 
# let foo (ignore: <call: 'a.'a -> unit>) = 
  let module Foo: FOO = struct type t = int let value = 1 end in 
  ignore#call Foo.value;; 
val foo : < call : 'a. 'a -> unit > -> unit = <fun> 
      

Camomile 0.6.6

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/26cc06e5aaea298f/1a5483b83ea52ba5#1a5483b83ea52ba5

Yamagata Yoriyuki announced:
I'm pleased to announce Camomile-0.6.6, a comprehensive Unicode 
library for OCaml.  This is a bug fix release to make its Makefile 
compatible to older shells.  You can download Camomile 0.6.6 from 
here. 

http://sourceforge.net/project/showfiles.php?group_id=40603&package_id=32800&release_id=429083
      

Sentence Segmenter

Archive: http://groups.google.com/group/fa.caml/browse_thread/thread/fda49194a153e50c/b8778e0e27060a57#b8778e0e27060a57

ramu ramamurthy announced:
This library can be used to segment newspaper style 
(english) text articles into sentences. It uses the 
Ocaml lexer with a simple set of lexical rules to 
classify those periods in the text that end sentences. 

This library is released under the BSD license and 
is available at: 

http://ramamurthy.ramu.googlepages.com/sentencesegmenter 

The library contains: 

*  README.txt 
* sentsegment.mli (interface) 
* sentsegment.mll (implementation) 
*  segTest.ml (API test) 
      

Using folding to read the cwn in vim 6+

Here is a quick trick to help you read this CWN if you are viewing it using vim (version 6 or greater).

:set foldmethod=expr
:set foldexpr=getline(v:lnum)=~'^=\\{78}$'?'&lt;1':1
zM

If you know of a better way, please let me know.


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