[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-12-03 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of November 26 to December 
03, 2013.

1) pfff 0.25, tools and APIs for program analysis of PHP/Java/JS/C/ML/PHP/...
2) improved BER MetaOCaml N101, for OCaml 4.01
3) how to create (format) directives that do not take any arguments?
4) Confusing behaviour of type inference for polymorphic classes
5) Main program in C - a script
6) Js_of_ocaml 1.4
7) Other Caml News


1) pfff 0.25, tools and APIs for program analysis of PHP/Java/JS/C/ML/PHP/...
Archive: 

** Yoann Padioleau announced:

pfff is a set of tools and APIs to perform some static analysis,
dynamic analysis, code visualizations, code navigations, or
style-preserving source-to-source transformations such as refactorings
on source code. For now the effort has focused mainly on PHP but there
is also good support for C, C++, Java, HTML, JavaScript, and CSS.
There is also very good support for OCaml and noweb (literate
programming) so that pfff can be used on the code of pfff itself.

For more information see the pfff wiki at:


The current release source code is accessible from:


There is now also an OPAM package for pfff. It contains though just
the parsers, visitors, and AST dumpers (for C, Java, Javascript, PHP,
ML, HTML and CSS). To install it just do:

   $ opam install pfff

Once installed you should have access to the different libraries
in ~/.opam/.../lib/pfff-lang_yyy. 

The AST dumpers are useful to get familiar with the constructors.
Here is an example:

   $ cd pfff
   $ cat demos/foo.js
function foo() {
  return 1;
}
   $ ./pfff -dump_js demos/foo.js
[FunDecl(
   {f_tok=Some(()); f_name=Some(("foo", ())); f_params=[]; 
f_return_type=None; 
f_body=[St(Return((), Some(L(Num(("1", (), Some((]; });
FinalDef(())]

In the next few weeks I'll make OPAM packages for the other components
of pfff: sgrep, spatch, stags, codemap, codegraph, the treemap
library, etc.

Thanks to:
 - Eric Cooper for the initial version of the java parser
 - Patrick Doane and Gerd Stolpmann for their html parser
 - Dario Teixeira for his css parser
 - Facebook
  

2) improved BER MetaOCaml N101, for OCaml 4.01
Archive: 

** oleg announced:

BER MetaOCaml N101 is now available. It is a strict superset of OCaml
4.01, extending it with staging annotations to construct and run typed
code values. Besides being compatible with the current version of
OCaml, BER N101 has a number of improvements and significant changes
compared to BER N100. The new API for running code will hopefully
encourage the development of new ways to execute code values.

The new BER N101 is not only source-compatible with OCaml 4.01 -- it
is also binary compatible. Any 4.01-built OCaml library and plugin
(including findlib) can be used with BER N101 in their binary form as
they are.  The building of BER N101 no longer involves bootstrapping
and is hence much faster.


The staging annotations are: 
bracket: .< e >.  to delay computation (to the future stage)
escape:  .~ e to perform a computation e and splice-in the result
run: !. e to run a future-stage computation, or code, now

A special type constructor, called 'code' builds the type of
future-stage computations, or code expressions:
# .< 2 + 4 >.;;
- : int code = .<2 + 4>. 
The type constructor 'code' takes as its argument the type of the
future-stage expression. Future-stage expressions are executed later,
but are type-checked now. Therefore, the generated code is assuredly
well-typed. Code fragments can be spliced into larger code contexts by 
using the escape construct: 
# let x = .< 2 + 4 >. in .< .~ x + .~ x >. ;;
- : int code = .<(2 + 4) + (2 + 4)>. 
The run construct takes a code value, executes it and returns its result. 
It is actually an ordinary function Runcode.run, which is also bound 
to the prefix operation (!.). These operations are in the module
Runcode (which is not opened by default). For example: 
# Runcode.run .< 2 + 3 >.;;
- : int = 5
# open Runcode;;
# !. . x + y >. 2 3;;
- : int = 5
The run construct only works on closed code values. Attempting to run
open code leads to an exception in the generator (which can be traced
as any other exception).


To the user, the two major differences of BER N101 from the previous
version are:

   -- the absence of environment classifiers (see below for more detail).

   -- The operation to run code is no longer a

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-11-26 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of November 19 to 26, 2013.

1) New OCaml.org design is now live!
2) extlib 1.6.0 released
3) Other Caml News


1) New OCaml.org design is now live!
Archive: 

** Amir Chaudhry announced:

As some of you may have noticed, the new OCaml.org site is now live!

The DNS may still be propagating so if  hasn't updated for
you then try . This post is in two parts: the first is
the announcement and the second is a call for content.


### New OCaml.org website design!

The new site represents a major milestone in the continuing growth of the
OCaml ecosystem. It's the culmination of a lot of volunteer work over the
last several months and I'd specifically like to thank Christophe, Ashish and
Philippe for their dedication (the commit logs speak volumes).

We began this journey just over 8 months ago with paper, pencils and a lot of
ideas. This led to a comprehensive set of wireframes and walk-throughs of the
site [1], which then developed into a collection of Photoshop mockups [2].
In turn, these formed the basis for the html templates and style sheets,
which we've adapted to fit our needs across the site.

Alongside the design process, we also considered the kind of structure and
workflow we aspired to, both as maintainers and contributors. This led us to
develop completely new tools for Markdown and templating in OCaml [3, 4, 5],
which are now available in OPAM for the benefit all. Working on all these
things in parallel definitely had it challenges (which I'll write about
separately) but the result has been worth the effort.

The journey is ongoing and we still have many more improvements we hope to
make. The site you see today primarily improves upon the design, structure
and workflows but in time, we also intend to incorporate more information on
packages and documentation. With the new tooling, moving the website forward
will become much easier and I hope that more members of the community become
involved in the generation and curation of content. This brings me to the
second part of this post.


### Call for content

We have lots of great content on the website but there are parts that could
do with refreshing and gaps that could be filled. As a community driven
site, we need ongoing contributions to ensure that the site best reflects its
members.

For example, if you do commercial work on OCaml then maybe you'd like to add
yourself to the support page [6]? Perhaps there are tutorials you can help to
complete, like 99 problems [7]? If you're not sure where to begin, there are
already a number of content issues you could contribute to [8].

Although we've gone through a bug-hunt already, feedback on the site is still
very welcome. You can either create an issue on the tracker (preferred), or
email the infrastructure list.

It's fantastic how far we've come and I look forward to the next phase!

Best wishes,
Amir

[1] 
[2] 
[3] 
[4] 
[5] 

[6] 
[7] 
[8] 
  

2) extlib 1.6.0 released
Archive: 

** ygrek announced:

New release of extlib is out, featuring new functions, bugfixes and
new ocamlfind package extlib_min without potentially conflicting modules 
(notably
UChar UTF8 conflict with Camomile).

Get it as usual at  or with `opam 
install extlib`.
Release notes for extlib-1.6.0 :
* Fix OCaml 4 Hashtbl compatibility
* Install additionally `extlib_min` with reduced set of modules (to mitigate 
linking conflicts)
* Build with debugging information by default
* Fix signature for `ExtList.iteri` and `OptParse.OptParser.error`
* Speed up `String.nsplit`
* New functions:
 * `String.find_from` (by Alexander Markov)
 * `IO.output_strings` (by Mehdi Dogguy)
 * `IO.read_float32` and `IO.write_float32` (by Philippe Strauss)
 * `IO.scanf` (by Warren Harris)
 * `UTF8.substring` (by Berke Durak)
 * `Enum.next`
  
** ygrek later added:

> * Install additionally `extlib_min` with reduced set of modules (to
>   mitigate linking conflicts)

After some more thought I don't really like this approach. See th

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-11-19 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of November 12 to 19, 2013.

1) Software engineer position available at Cryptosense
2) Engineer and funded PhD position available, formal methods applied to 
filesystems
3) open-source software at OCamlPro and TypeRex-Pro
4) Other Caml News


1) Software engineer position available at Cryptosense
Archive: 

** Romain Bardou announced:

Cryptosense is a start-up company which develops formal tools for
finding and fixing security flaws in cryptographic systems. We use
model-checking and symbolic machine learning techniques, amongst other
technologies. Our tools are developed in OCaml.

Cryptosense is recruiting a junior and a senior software engineer.

Profile
===

You are an experienced programmer or recently qualified PhD. You
are proficient in at least one functional language. You want to
be part of a team of developers who follow agile programming
principles, and exchange and review each other's code. You like
to think outside the box to discover unexpected behavior that
might lead to security flaws. You are at ease holding technical
conversations in English.

Job description
===

You will be part of a small team during the exciting times of the
emergence of a new company.  Your work will have great impact on the
company's products, which are already being used to secure critical
infrastructure of organisations worldwide.

You will contribute to the design and code of robust software. Depending
on your skills and interests, you might work on one or several of the
following:
- automatic reverse engineering and learning of the behaviour of API
implementations;
- model-checking algorithms dedicated to finding cryptographic key
management vulnerabilities;
- domain-specific language to model cryptographic key management APIs,
similar to software verification;
- use of this DSL to model new APIs;
- robust monitoring and filtering tools;
- graphical user interfaces.

Expertise in system and server administration (Linux) is a plus. You
could be given responsibility for the stability of our server for our
clients.

Salary is negotiable and will depend on experience. Stock options are
a possibility. The positions will be available from December 2013.

Location


Our office is located in Paris, between Montparnasse and the Jardin du
Luxembourg.

Contact
===

Send your CV and cover letter to [email protected]. Informal
enquiries are also welcome.


  

2) Engineer and funded PhD position available, formal methods applied to 
filesystems
Archive: 

** Tom Ridge announced:

Project
===

The goal of the EPSRC-funded "Future filesystems" project is to apply
formal methods to the specification, validation, implementation and
verification of filesystems. The PI is Tom Ridge
(Leicester).

We have 2 positions available.

Position: engineer (6 months)
=

We seek a skilled programmer/developer/engineer to help with
validation of a specification of POSIX-like filesystems. The
specification is written in a pure subset of OCaml, and much of the
supporting infrastructure is also written in OCaml. Further details
are here:



The closing date for applications is ***Wednesday, November 20th***
(i.e. very soon).


Position: PhD student
=

We may also have funds to support a PhD student. The student may work
on the project described above, or may choose to work on another topic
broadly in the area of formal methods and theorem proving. Please
contact Tom Ridge (tr61 at le.ac.uk) if you are interested (include a
CV and a statement describing your proposed research topic). A formal
advert may appear in the future, depending on availability of funds.
  

3) open-source software at OCamlPro and TypeRex-Pro
Archive: 

** OCamlPro announced:

We have been contributing to the OCaml ecosystem for more than two
years now, with open-source tools (opam, ocp-indent, ocp-build, etc.),
open-source libraries (ocplib-endian, ocplib-wxOCaml), websites
(try.ocamlpro.com) and documentation (Cheat Sheets), all gathered
under the code name TypeRex (), and thanks to
our long term and close partnership with Jane Street who has helped
fund a large part of these projects.

Some of thes

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-11-12 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of November 05 to 12, 2013.

1) Migration plan and bug hunt for ocaml.org - http://preview.ocaml.org
2) out-of-the-heap 'a arrays ?
3) final release of OPAM 1.1.0
4) opam2debian v0.1.0: Create Debian package that contains a set of OPAM 
packages
5) Real World OCaml is finished
6) Real World OCaml now available online and print
7) exenum.0.6: exhaustive enumerations for datatypes
8) Other Caml News


1) Migration plan and bug hunt for ocaml.org - http://preview.ocaml.org
Archive: 

** Amir Chaudhry announced:

We're close to releasing the new design of ocaml.org but need help from the
community to identify and fix bugs before we switch next week.

Ashish, Christophe, Philippe and I have been discussing how we should go
about this and below is the plan for migration. If you'd like to discuss any
of this, then the infrastructure list is the best place to do so (cced).

1. We've made a new branch on the main ocaml.org repository [1] with the
redesign. This branch is a fork of the main one and we've simply cleaned up
and replayed our git commits there.

2. We've built a live version of the new site, which is visible at
 - this is rebuilt every few minutes from the branch
mentioned above.

3. Over the course of one week, we ask the community to review the new site
and report any bugs or problems on the issue tracker [2]. We triage those
bugs to identify any blockers and work on those first. This is the phase
we'll be in from *today*.

4. After one week (7 days), and after blocking bugs have been fixed, we merge
the site into the main branch. This would effectively present the new site
to the world.

During the above, we would not be able to accept any new pull requests on the
old site but would be happy to accept them on the new branch. Hence,
restricting the time frame to one week.

Please note that the above is only intended to merge the *design* and
*toolchain* for the new site. Specifically, we've created new landing pages,
have new style sheets and have restructured the site's contents as well as
made some new libraries [3, 4]. The new toolchain means people can write
files in markdown, which makes contributing content a lot easier.

Since the files are on GitHub, people don't even need to clone the site
locally to make simple edits (or even add new pages). Just click the 'Edit
this page' link in the footer to be taken to the right file in the repository
and GitHub's editing and pull request features will allow you to make changes
and submit updates, all from within your browser [5].

There is still work to be done on adding new features but the above changes
are already a great improvement to the site and are ready to be reviewed and
merged.

[1] 
[2] 
[3] 
[4] 
[5] 

  

2) out-of-the-heap 'a arrays ?
Archive: 

** Jean Krivine asked and Gerd Stolpmann replied:

> I am developing a graph rewriting algorithm which operates on large
> graphs. Because of the large data structure the GC becomes quite
> inefficient for two reasons that I am inferring: 
> 1/ there is no correlation between the time of allocation of an object
> and its likelihood to be garbage collected.
> 2/ even when there is nothing to collect, I guess that the GC is still
> inspecting the heap.
> 
> 
> Point 1 is inducing some memory leak and point 2 is just inefficient.
> I think I took care of point 1 by using my own allocation heap (so
> there is nothing to collect for the GC). But to take care of point 2 I
> guess I need to tell the GC that my heap (an extensible array) should
> not be inspected.
> 
> 
> As far as I understand there is a module Ancient which I can use to
> tell the GC to ignore my array but, if I understand well, it would
> only work if I use my array in a read only fashion. 
> I also thought I could use Bigarray, but it seems it can only be used
> for basic array types.
> 
> 
> To summarize my question: is there a (reasonable) way to implement an
> 'a array out of the ocaml heap ? 

Yes, but it's cumbersome. I did that for the Netmulticore library of
Ocamlnet.

Here are the basics: You can have a pointer from the normal heap to
other memory, and the GC will not follow it. You cannot have pointers
the other way round, bec

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-11-06 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of October 22 to November 05, 
2013.

Sorry for the silence last week, I was on an island with tethering-only 
internet access.

1) Robust left to right flow for record disambiguation
2) random-generator 0.1
3) A useful Makefile collection for OCaml projects
4) ODT 3.0 released
5) LLVM OCaml bindings
6) Other Caml News


1) Robust left to right flow for record disambiguation
Archive: 

** Bob Zhang asked:

Record disambiguation is a practical feature, it helps a lot in
writing open-free code.
In practice, I found it is a bit limited, below is two scenarios
that the compiler can not infer in a correct way, will this be
improved in the future by any chance?
 From the user's point of view, annotating the toplevel is quite
acceptable, maybe the typechecker could take the type-annotation as a
higher priority.
---
   1.
let f (ls:t) =
   ls |> List.map (fun x -> x.loc) (* cannot inferred x.loc*)
   2.
type t = {loc:string}
type v = {loc:string; x:int}
type u = [`Key of t]
let f (u:t) =
  match u with
  | `Key {loc} -> loc (* does not compile *)
  
** Jacques Garrigue replied:

Case 1 would require a new specification of how type propagation works.
In particular, propagating from an argument to another argument.
For this reason, the probability that it gets done is low.
(I know that F# handles this case in a special way, but do we want to introduce
a special case just for |> ?)

Case 2 seems more reasonable (after replacing (u:t) by (u:u)).
In particular,
   let f (u:u) =
match u with `Key loc -> loc.loc
already works, so it seems strange that the pattern-matching version doesn't.
  
** Alain Frisch then added:

> Case 1 would require a new specification of how type propagation works.
> In particular, propagating from an argument to another argument.
> For this reason, the probability that it gets done is low.
> (I know that F# handles this case in a special way, but do we want to 
> introduce
> a special case just for |> ?)

The situation with List.map (or similar iterators) is quite common, and 
remains one of the only cases where local annotations are often required.

There is already a left-to-right propagation between arguments:

  type t = {a: int};;
  type s = {a: string};;
  List.map (fun ({a} : t) -> a + 1) [{a=2}];;   (* accepted *)
  List.map (fun {a} -> a + 1) [({a=2} : t)];;   (* rejected *)


With -principal, the first case is reported as non principal (warning 18).

Is there any practical or theoretical problem with specifying the 
information flow in order to make it principal?



For List.map and similar cases, one often prefers the type information 
to flow from the data stucture to the local abstraction.  One can define:

  let map l f = List.map f l

so that:

  map [{a=2}] (fun ({a} : t) -> a + 1);;   (* rejected *)
  map [({a=2} : t)] (fun {a} -> a + 1);;   (* accepted *)


One could imagine heuristics (based either on the function type, or on 
the argument shape) to pick a different ordering, but it seems much 
better to have a simple and predictable flow, and the left-to-right 
seems the most natural one between function arguments.  If we specify 
such information flow, it is then the responsibility of the library 
author to choose a "good" ordering.  I hoped that labeled arguments 
could let the client code choose a different one, but this doesn't work:

  let map ~f l = List.map f l

  map [{a=2}] ~f:(fun ({a} : t) -> a + 1);;   (* accepted *)
  map ~f:(fun ({a} : t) -> a + 1) [{a=2}];;   (* accepted *)

  map [({a=2} : t)] ~f:(fun {a} -> a + 1);;   (* rejected *)
  map ~f:(fun {a} -> a + 1) [({a=2} : t)];;   (* rejected *)


Does it seem reasonable to use the actual ordering between arguments on 
the call site rather than the one defined by the function type?
  
** Didier Remy then said and Alain Frisch replied:

> I don't think specifying the information flow between left and right
> (always-left-to-right, always-right-to-left, or depending-on-examples) is a
> good design. This leads to non predictable type inference and less robust
> programs  : refactoring a function by just changing the order of parameters
> (and consistently changing the order of arguments in all uses of the
> function) may break existing programs and also require new annotations.

This is already the case, except for people using -principal.  I know it 
is recommended to use this option (at least once in a while), but I 
doubt many users actually do it.  (And FWIW, -principal is so slow on 
our code base that we cannot actually use it in practice -- this is 
probably related to the way we use object types.)

As a user, I think I'm willing to pay the pri

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-10-22 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of October 15 to 22, 2013.

1) phphard
2) IPv6 packet parsing
3) Marshalling: automatic discard of unmashalable data via ephemerons
4) Other Caml News


1) phphard
Archive: 

** Stanis?aw Findeisen announced:

I would like to draw your attention to phphard project, which is a PHP
source code static analyzer. Its aim is to strong type PHP programs and
detect as many bugs at compile time as possible.

The project is in its very early stage: most of PHP parsing is done
(using ocamllex + ocamlyacc), some pretty printing is done, no real
source code analysis is done. It is now hosted here:


 (source code)

I will welcome your ideas, feedback and contributions to the project.
This is something I had been working on for some time, but have no
resources (time+money) to finish this alone.

I thinks it still makes sense to use PHP for web development as LAMP
stack is quite efficient compared to some other stacks like Java. :)
Plus there is lots of existing PHP code.

I must confess that I have only superficially scanned through existing
solutions to this static analysis problem. Some of the existing software
(like HipHop VM from Facebook) seems quite complex, however I couldn't
find anything that would be:

* exactly scoped on PHP + static analysis
* written in a functional language.

Therefore I think this project has a potential and working on it can
bring you glory. :)

I believe purely functional style (non-modifiable data structures!) will
be beneficial in this application.

If you want to contribute please join the project on OCaml Forge. The
source code is now on GitHub and it seems cool to me (but we can discuss
that if you have arguments).
  
** Stéphane Legrand then suggested and David MENTRE added:

> Did you take a look at Pfff? : 

And more exactly Scheck: 
  

2) IPv6 packet parsing
Archive: 

** Johan Mazel asked and Stéphane Glondu replied:

> I am aware of several implementation for IPv4 packet parsing
> (ocaml-packet, melange, promiwag and maybe others that I missed).
> However, up to my knowledge, none of these implementations offer IPv6
> parsing functionnalities.
> I would like to know if there is anything available ?

Using bitstring makes parsing binary structures such as IPv6 (and IPv4)
packets easy:

  
  
** rixed also replied:

IPv6 is on the TODO list for robinet[1], a small lib that parse
network traffic (with the help of bitstring which was already
suggested). It's hard to tell if this small library fits your use
case but if it does I'd gladly add support for IPv6.

[1]: 
  
** The following exchange occurred between Anil Madhavapeddy, rixed, and Gerd 
Stolpmann:

Anil Madhavapeddy:
> rixed:
> > Anil Madhavapeddy:
> > > One feature I'd really like to see in Bitstring is support for Bigarray,
> > > since that avoids a copy into the OCaml heap and lets us do quite high
> > > performance parsing.  If I remember right, there was a patch on the
> > > Bitstring issue tracker, but it wasn't parameterised (so it's either
> > > Bistring+string or Bitstring+bigarray, which isn't ideal).
> > 
> > Pardon my lack of familiarity with bigarrays, but I can't see what's the
> > difference between copying packets from pcap ring buffer into a bigarray
> > or into a string. Or do you mean using Bigarray.map_file on the whole
> > raw ring buffer and handle it without pcap help?

Without knowing details: maybe no copy is required at all? The pcap ring
buffer could be directly wrapped as Bigarray.

> We have a number of use-cases that run OCaml in kernel mode, directly
> operating on packets read from a network driver that's also written in
> OCaml.  Bigarrays are used as the mechanism for passing around externally
> allocated memory (i.e. network card buffers) directly, whereas inspecting
> them with a string-based Bigarray requires an expensive data copy.
> 
> See: 
> or 

For similar reasons, I also added some Bigarray functions to Ocamlnet:



If you look at the stub behind e.g. Unix.read, you'll see that the data
is first read into an internal unaligned buffer, and then copied to the
strin

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-10-15 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of October 08 to 15, 2013.

1) equivalent checking of ocaml program?
2) Procord 0.1.0: Delegate tasks to other processes
3) OCaml 2013: papers and slides are available
4) OPAM 1.1.0 Release Candidate
5) Marshalling: automatic discard of unmashalable data via ephemerons
6) Developper position: designing a C front-end in OCaml
7) Other Caml News


1) equivalent checking of ocaml program?
Archive: 

** Continuing the thread from last week, Gabriel Scherer said:

Shortly after writing my email, I found out that Ong had co-written a
recent article (CAV'12) on using those techniques precisely for
equivalence checking:

  Hector: An Equivalence Checker for a Higher-Order Fragment of ML
  David Hopkins' Andrzej S. Murawski and C.-H Luke Ong
  2012
  

They restrict themselves to a order-bounded fragment of higher-order
function types (and only allow ground reference types) suggested by
game-semantics considerations, on which equivalence checking is
decidable, and leave extensions to more complex settings where
equivalence becomes indecidable to future work.
You probably know more about this than I do (this is not my field at
all), but my understanding is that whether the problems are decidable
or not is not an actual concern with model checking, as even in
decidable cases the tools most often run out of time; actual
feasability on concrete examples seems the most useful way to evaluate
those, so I don't think going to undecidable fragments would be a
problem in principle. Of course, the more complex the fragment, the
more expansive the computations.
  

2) Procord 0.1.0: Delegate tasks to other processes
Archive: 

** Romain Bardou announced:

I am happy to announce the first release of Procord, a portable library
to delegate tasks to other processes.

Obtain it with opam:

  opam install procord

Or, download the tarball:

  

View a minimal, commented example:

  

You can browse the API at:

  

Procord can spawn local worker processes or communicate using sockets to
a remote worker server. Workers will receive an input, execute a
function on this input, and send back the result. Meanwhile, the main
program can continue to run while waiting for the results.

Not relying on threads, Procord is robust - a segmentation fault in the
worker will not kill the main program. Not relying on fork, Procord is
portable - it has been tested on Linux and Windows.

Procord provides an easy way to have the same executable act as a worker
- local or remote - or as the main program. The actual behavior can be
specified on the command-line. The default is to run as the main
program, which delegates tasks by running itself.

I will present Procord at the OUPS meeting of this evening.
  
** Arnaud Spiwack asked and Romain Bardou replied:

> I see you are using Unix.kill to kill processes. But I was under the
> impression that it didn't work properly on Windows. Am I mistaken?

Indeed. In fact I made a feature request about this:



So, just waiting for OCaml 4.02 will solve the issue.

If waiting is not an option I can of course add this in Procord. I
should at least provide a way to get the PID / Process Handle so that
one can call TerminateProcess using his own binding.

While we are discussing the differences between Windows and Linux, there
is actually another one: the Windows server does not fork and, thus,
only accepts one task at a time. This could be solved by having the
server execute himself to run the tasks. But before actually
implementing this I prefer to wait and see whether there is a real need
(Windows servers are less common).
  
** Louis Gesbert then suggested and Jacques Garrigue added:

> You may find the bindings for Terminate_process in ocaml-top useful [1].
> 
> I also had to handle sending a SIGINT to the ocaml toplevel, which wasn't 
> very fun,
> 
> 
> [1] 

If you're just trying to kill an ocaml toplevel that you have spawned yourself,
you can have a look at labltk/browser/shell.ml.
By setting the environment variable OCAMLSIGPIPE and sending T or C to
this pipe you can kill or interrupt the ocaml toplevel asynchronously.
(At the time I implemented that, there was basically no other wa

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-10-08 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of October 01 to 08, 2013.

1) OASIS help - libraries with mixed C/C++ part
2) Feedback on the ocaml.org redesign and logo
3) QCheck 0.1
4) Other Caml News


1) OASIS help - libraries with mixed C/C++ part
Archive: 

** Micha? Kurcewicz asked and Philippe Veber replied:

> I am migrating some old code from OCamlMakefile to a oasis/ocamlbuild
> based build process. While the migration is generally straightforward, I
> have encountered some problems with a library where the C part includes
> mixed C/C++ code. Putting the C++ files into CSources: in _oasis does not
> seem to work, the files are not even copied over to the _build directory,
> changing the file extensions and adding some options (-x c++) also does not
> solve the problem. What is recommended way to build libraries that include
> a mixed C/C++ part using OASIS/ocamlbuild?

for an example you can have a look at a binding [1] of the Irrlicht 3d
engine (for the record my fork [2] currently has a small addition) or a
binding [3] I started (but never got very far) of the Ogre3D library. The
latter shows how to put the C++ files in a subdirectory, which was not that
easy to obtain.

HTH,
  Philippe.

[1] 
[2] 
[3] 
  
** ygrek also replied:

One also needs to link with stdc++
The following should work

  CCopt: -g -x c++ -O2 -Wextra -Wstrict-overflow=5 -fno-strict-aliasing 
-Wfatal-errors
  CClib: -lstdc++
  

2) Feedback on the ocaml.org redesign and logo
Archive: 

** Amir Chaudhry said:

Just a brief reminder that I'd still like feedback on the OCaml logo and
ocaml.org redesign work (see previous message below).

I'm continuing the discussion on the infrastructure list [1] about the
redesign and how we migrate the current site to the new design. If anyone
would like to join in please do so over there.

[1] 
  

3) QCheck 0.1
Archive: 

** Simon Cruanes announced:

I'm happy to announce the first release of a small QuickCheck
implementation for OCaml, named `QCheck`. It consists in writing
invariants as function t -> bool for some type t, and then checking that
the invariant holds on randomly generated instances of t.

QCheck is designed so that writing tests is as easy as possible[1],
especially for Arbitrary instances (the part where you generate random
values of a type) where it provides many combinators.

The library requires OCaml >= 4.00.1, and is available under the BSD
license on opam via:

$ opam install qcheck

You can find documentation at:

source code at:

and some explanations here:

  

4) 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 .

FPDays 2013 Real World OCaml tutorial in Cambridge:
  

Announcing CCSS 1.4:
  

Hugo-a-go-go:
  

Using Travis for secure deployments with SSH:
  

SSL up again, special thanks to Gabriel Kerneis:
  

Uucd 1.0.0 and Uunf 0.9.2:
  
  

Old cwn


If you happen to miss a CWN, you can send me a message
([email protected]) 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 at


[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-10-01 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of September 24 to October 
01, 2013.

1) Feedback on the ocaml.org redesign and logo
2) Enhanced OCaml Documentation 4.01
3) Gg 0.8.0 and Vg 0.8.0
4) otags reloaded 4.01.1 for OCaml 4.01
5) meetup OCaml-Pairs (OUPS), mercredi 9 octobre à l'IRILL
6) embedding js_of_ocaml output?
7) OUnit v2.0.0
8) Thread behaviour
9) Esterel Technologies is looking for an Ocaml SW developer in Toulouse (CDI)
10) equivalent checking of ocaml program?
11) LablGtk 2.18.0 and LablGL 1.05
12) Uucd 1.0.0 & Uunf 0.9.2
13) Other Caml News


1) Feedback on the ocaml.org redesign and logo
Archive: 

** Amir Chaudhry asked:

I've just put up a blog post asking for feedback on the ocaml.org redesign
[1]. I'm specifically interested in getting feedback on (1) the second
iteration of the OCaml Logo and (2) the new design for ocaml.org. See the
blog post for more information. We're tracking feedback via issues [2] and
there are some known issues already listed there.

[1] 
[2] 
  

2) Enhanced OCaml Documentation 4.01
Archive: 

** Hendrik Tews announced:

I would like to announce

 The Enhanced OCaml Documentation 
  Version 4.01
   available via 

This version of the OCaml manual enhances the original html
version in the following way:

- Changes (wrt version 4.00) are tagged with icons and color 
- an additional appendix contains all grammar rules


As always, the enhanced documentation reveals some points that
have not been mentioned in the official 4.01 announcement from
Damien Doligez. This time, the most important such point is that
the documentation approves what long-term OCaml hackers have been
using for years to improve their code. You can use an infix
symbol as for-loop-variable:

   for (+) = ... to ... do ... done

will (mostly) word as (un)expected!
;-)
  

3) Gg 0.8.0 and Vg 0.8.0
Archive: 

** Daniel Bünzli announced:

It's my pleasure to announce the first releases of:

* Gg, a module providing basic types for computer graphics
* Vg, a declarative 2D vector graphics library.

More on these and their aim at the end of the message.  

My thanks to Edwin Török who contributed the color conversion functions
in Gg and helped with color science questions.

Besides, while I can trace my work on Vg to at least 2008 it would
still remain unreleased without the sponsorship of both Citrix Systems R&D
and OCaml Labs. Many thanks to them and to the inspiring OCaml
Cambridgian atmosphere.

Comments are welcome,

Daniel


# Note on installing

Once opam 1.1 is released, the packages will be in opam's repository  
and can be installed with:

  opam install gg vg# (SVG renderer only)
  opam install gg uutf otfm js_of_ocaml vg# (all renderers).  

If you are eager to use the software and have the opam 1.1 beta installed  
you can get them through my unreleased software repo:

  opam repo add erratique-u 
  opam upgrade
  opam install gg uutf otfm js_of_ocaml vg

these packages will be removed from erratique-u once they are in the  
opam repository.


# Gg

Gg is an OCaml module providing basic types for computer graphics. It
defines types and functions for floats, vectors, points, sizes,
matrices, quaternions, axis-aligned boxes, colors, color spaces, and
raster data.

Gg is made of a single, independent, module and distributed under the
BSD3 license.  

The aim of Gg is to provide an efficient, immutable, C friendly, type
infrastructure for computer graphics programming. It's neither a
general purpose linear algebra package nor a computational geometry
library. I hope it can serve as a minimal common ground for other
graphics libraries to exchange data without having to depend on each
other.

From an API point of view the library is considered mostly
complete. The only thing that could still change significantly is the
support for representing raster data (Gg.raster), in any case,
consult the documentation which clarifies what may still change.

Home page:   
Documentation: 
github: 


# Vg

Vg 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-09-24 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of September 17 to 24, 2013.

1) OCaml on Android
2) OCaml release 4.01.0
3) OCaml vs Ada and/or GUI options
4) Beta release of OPAM 1.1.0
5) Ocaml on an embedded arm system (no linux)
6) Call for Talks - Open World Forum / OSDC
7) SIunits 0.1
8) ocaml interface to berkeley db?
9) Other Caml News


1) OCaml on Android
Archive: 

** Jon Harrop asked and Anil Madhavapeddy replied:

> What is the status of OCaml on Android? Have any Android apps been written
> in OCaml?

There's a GitHub OPAM repository here:


and I've just ordered myself my first Android device, as Mirage has just been
ported over to it a few days ago in UNIX mode:


I haven't tried it myself yet, but intend to once my physical device shows
up. Googling reveals a few applications built using it already, but I have
no idea how substantial they are.
  
** Thomas Sibut-Pinote also replied:

I'm not sure if this anwers your question, but someone wrote an Ocaml
toplevel for Android:


  
** Kristopher Micinski  said and Ivan Gotovchits suggested:

> The basic problem with running OCaml on Android is that pretty much
> everything (minus a few system services / daemons, for example) runs
> inside a Dalvik VM.  Everything that is a "real app" thus uses the
> facilities of the SDK to interact with the underlying
> system.  (Various services such as internet can be opened via a raw
> socket, and are protected via lower level system modifications.)

And what about OCaml-Java [1]. Will it be possible to use it with
dalvik?

[1] 
  
** Kristopher Micinski then said and Xavier Clerc added:

> With a little bit of hacking it'd probably work, but I'm not sure of the
> status of ocaml-java and haven't looked into the implementation details.
> Since ocaml-java outputs class files (afaik) you'd have to sort of hack the
> android build pipeline yourself, but that wouldn't be the hard part: all
> the tools are there. The harder part is that the Android SDK is very Java
> oriented, and it just feels awkward as hell to use in OCaml even if you
> were to write a thin wrapper around the SDK.

In theory, you are right that it wouldn't be hard.
In practice, the problem is that OCaml-Java emits classes
for Java 1.7 while (to the best of my knowledge) Android
only accepts Java 1.6 classes. As far as I know, there is no
other pending problem.

From this point, the question would be: is it better to wait
for Android to update to Java 1.7 (or even 1.8...), or to
modify OCaml-Java? Honestly, I would need quite a bit
of encouragement to modify OCaml-Java in this direction...

Regarding interaction with the classes of the Android SDK,
one may be interested in the typer extension allowing to
manipulate Java instances from pure OCaml code:

The main potential problem with this approach is that the
extension currently allows only to implement interfaces, but
not to extend classes. It may be a problem if for example the
event system of Android is based on abstract classes.
Another problem may be the "linking", i. e. the way Android
expects to execute an application: is it a bare main method,
or is there a need to implement/extend a given interface/class?
  
** Kristopher Micinski said and Xavier Clerc replied:

> Yes, it does rely on extending an abstract class. This does, in fact,
> permeate the framework.

This problem is indeed to be fixed in a future version of OCaml-Java.
Currently, you can extend an abstract class only in well delimited
circumstances, for example to build an applet.
  
** Alexandre Pilkiewicz said:


  
** Richard Mortier suggested and Xavier Clerc replied:

> a colleague here ported cadmium to android a while back. don't know
> how relevant/working it still is though.
>
> 

Beware, Cadmium is only providing an OCaml bytecode interpreter
written in Java. You hence only get a Java equivalent of the "ocamlrun"
program.
  

2) OCaml release 4.01.0
Archive: 

** Continuing the thread on this release, Nicolas Braud-Santoni announced:

Exherbo [1] since tonight [2].

[1] 
[2] 


[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-09-10 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of September 03 to 10, 2013.

1) Pippo: a pretty interesting pre-processor that uses OCaml
2) OCaml 4.01.0+rc2
3) Uutf 0.9.3 & Xmlm 1.2.0
4) OCamlPro Highlights, August 2013
5) Other Caml News


1) Pippo: a pretty interesting pre-processor that uses OCaml
Archive: 

** Replying to last week's announcement, Martin Jambon said:

 It looks a lot like camlmix :-) ().
  

2) OCaml 4.01.0+rc2
Archive: 

** Damien Doligez announced:

The release of OCaml version 4.01.0 is imminent (next Thursday). We have
created a second release candidate for your testing pleasure. Please
download the sources, compile, install, and test your favourite
software with it. Then let me know whether it works for you.

We want to know about any show-stopping bugs, especially in the
compilation and installation phases.

This release candidate is available as source code at this
address: 

Happy hacking,

-- Damien Doligez for the OCaml team.


Changes from the RC1:

Two bug fixes:
- PR#6158: Fatal error using GADTs
- PR#6163: Assert_failure using polymorphic variants in GADTs

A small change to ocamlbuild to work better with ocamlfind when using
a plug-in.
  

3) Uutf 0.9.3 & Xmlm 1.2.0
Archive: 

** Daniel Bünzli announced:

I'd like to announce the release of Uutf 0.9.3 and Xmlm 1.2.0, see below for
details. They should soon be available in opam.

Best,

Daniel


* Uutf 0.9.3

Bugfix release (thanks to Edwin Török for the report), see the release notes
for details.

Home page: 
Release notes: 


* Xmlm 1.2.0

Minor release that improves the odds of generating well-formed XML by
automatically translating illegal XML unicode characters present in output
`Data signals or attributes to the unicode replacement character U+FFFD
(thanks to David Sheets for insisting that something should be done about
that). It also deprecates the following two features:

1) The (non-standard) ability to decode more than one document with the same
input abstraction.
See 

2) The functorial interface that allows to specify alternative datatypes for
strings and internal buffers.
See 

Please get in touch if 1) or 2) is important/affects you.

For other changes consult the release notes.

Home page: 
Release notes: 
  

4) OCamlPro Highlights, August 2013
Archive: 

** Fabrice Le Fessant announced:

Here is the link to OCamlPro's report on its activities in August
2013 on OCaml:


  

5) 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 .

OUnit 2.0 progress, August 2013:
  


Uutf 0.9.3 and Xmlm 1.2.0:
  

LablTk:
  

Community Release of PDF Command Line Tools:
  

OCamlPro Highlights, August 2013:
  
  

Old cwn


If you happen to miss a CWN, you can send me a message
([email protected]) 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 at


[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-09-03 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of August 27 to September 03, 
2013.

1) Ocamlnet-3.7.3
2) OCaml 4.01.0 RC1
3) Literate (sort-of) programming in OCaml
4) Pippo: a pretty interesting pre-processor that uses OCaml
5) Other Caml News


1) Ocamlnet-3.7.3
Archive: 

** Gerd Stolpmann announced:

Ocamlnet-3.7.3 is now available for download. Changes in this release:

 - Support for ocaml-4.01
 - New directives for ocamlrpcgen to control the language mapping better
 - Bug fixes here and there

Details about this release can be found on the project page:



See ChageLog for a detailed list of changes:



Gerd


PS. The versions 3.7.0 to 3.7.2 were release attempts but turned out as
buggy. Don't use them if you fetched one (they were visible for a short
period).
  

2) OCaml 4.01.0 RC1
Archive: 

** Damien Doligez announced:

The release of OCaml version 4.01.0 is imminent.  We have
created a release candidate for your testing pleasure.  Please
download the sources, compile, install, and test your favourite
software with it (or try it with OPAM).  Then let me know
whether it works for you.

We want to know about any show-stopping bugs, especially in the
compilation and installation phases.

This release candidate is available as source code at this
address: 

It will become the official release in one week unless a
show-stopping bug is discovered in the meantime.

Happy hacking,

-- Damien Doligez for the OCaml team.


OCaml 4.01.0:
-

(Changes that can break existing programs are marked with a "*")

Other libraries:
- Labltk: updated to Tcl/Tk 8.6.

Type system:
* Propagate type information towards pattern-matching, even in the presence of
  polymorphic variants (discarding only information about possibly-present
  constructors). As a result, matching against absent constructors is no longer
  allowed for exact and fixed polymorphic variant types.
* PR#6035: Reject multiple declarations of the same method or instance variable
  in an object

Compilers:
- PR#5861: raise an error when multiple private keywords are used in type
  declarations
- PR#5634: parsetree rewriter (-ppx flag)
- ocamldep now supports -absname
- PR#5768: On "unbound identifier" errors, use spell-checking to suggest names
  present in the environment
- ocamlc has a new option -dsource to visualize the parsetree
- tools/eqparsetree compares two parsetree ignoring location
- ocamlopt now uses clang as assembler on OS X if available, which enables
  CFI support for OS X.
- Added a new -short-paths option, which attempts to use the shortest
  representation for type constructors inside types, taking open modules
  into account. This can make types much more readable if your code
  uses lots of functors.
- PR#5986: added flag -compat-32 to ocamlc, ensuring that the generated
  bytecode executable can be loaded on 32-bit hosts.
- PR#5980: warning on open statements which shadow an existing identifier
  (if it is actually used in the scope of the open)
* warning 3 is extended to warn about other deprecated features:
  - ISO-latin1 characters in identifiers
  - uses of the (&) and (or) operators instead of (&&) and (||)
- Experimental OCAMLPARAM for ocamlc and ocamlopt
- PR#5571: incorrect ordinal number in error message
- PR#6073: add signature to Tstr_include

Standard library:
- PR#5899: expose a way to inspect the current call stack
  (Printexc.get_callstack)
- PR#5986: new flag Marshal.Compat_32 for the serialization functions
  (Marshal.to_*), forcing the output to be readable on 32-bit hosts.
- Add optimized composition operators |> and @@ in Pervasives

Other libraries:
- PR#5568: add O_CLOEXEC flag to Unix.openfile, so that the returned
  file descriptor is created in close-on-exec mode

Runtime system:
* PR#6019: more efficient implementation of caml_modify() and caml_initialize().
  The new implementations are less lenient than the old ones: now,
  the destination pointer of caml_modify() must point within the minor or
  major heaps, and the destination pointer of caml_initialize() must
  point within the major heap.

Internals:
- Moved debugger/envaux.ml to typing/envaux.ml to publish env_of_only_summary
  as part of compilerlibs, to be used on bin-annot files.
- The test suite can now be run without installing OCaml first.

Bug fixes:
- PR#3236: Document the fact that queues are not thread-safe
- PR#3468: (part 1) Sys_error 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-08-27 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of July 30 to August 27, 2013.

Sorry for the hiatus, I was away for three weeks with tethering-only internet 
access.

1) OCaml-Java: blending OCaml & Java
2) Book announcement: "Parallel and Concurrent Programming in Haskell"
3) New iteration of the Windows installer
4) WODI (beta4) (Windows port of GODI)
5) Call for Participation: CUFP 2013
6) Real World OCaml beta2 now available (final beta)
7) ocaml+opam in Cloud9 IDE
8) OCaml-RDF 0.6.0
9) Turning floating point errors into exceptions
10) CamlPDF 1.7
11) OCaml 4.01.0+beta1
12) Merlin 1.3 -- advanced Vim and Emacs editor modes
13) Threads and "transaction isolation" in OCaml
14) should.ml, literate assertions for OCaml
15) Other Caml News


1) OCaml-Java: blending OCaml & Java
Archive: 

** Xavier Clerc announced:

OCaml-Java is a project whose goal is to provide a compiler
targeting the JVM. The related objectives are to gain access
to a greater number of libraries, and to be able to take advantage
of multiple cores.

During the past few months, OCaml-Java has greatly evolved
and now contains the necessary mechanisms to easily blend
OCaml and Java in a single application, and to develop multicore
programs.

To access OCaml code from Java code, a tool (namely "ocamlwrap")
allows to generate Java class definitions mapping OCaml types
and values to Java elements. An overview of the tool is available
at the following address:


To access Java code from OCaml code, an extension to the original
OCaml typer allows to create and manipulate Java instances from
purely OCaml code. The typer extension is presented at the
following address:


To take advantage of multiple cores, various abstractions are
provided by the newly-introduced "Concurrent" library. It features
low-level abstractions such as threads and locks, but also high-level
abstractions such as map/reduce computations and parallel
operations over arrays. An introduction to the library and its
ocamldoc-generated documentation can be reached at the following
addresses:



The project is available as a binary distribution, just needing an
installed Java 1.7 SDK to be used. The binary distribution can be
downloaded at:

while the bugtracker can be reached at:


To conclude, I would like to acknowledge the OCaml Labs for
welcoming me. A significant part of this work has actually been
performed while visiting the OCaml Labs.
  

2) Book announcement: "Parallel and Concurrent Programming in Haskell"
Archive: 

** Francois Berenger announced:

The book is written by Simon Marlow
and published by O'Reilly.

OK it's for Haskell, but I'm sure
some people in here will be interested.

There is a free online reading link:

  

3) New iteration of the Windows installer
Archive: 

** Jonathan Protzenko announced:

Dear OCaml programmers using Windows,

I'm happy to announce a new iteration of the Windows installer that I'm 
currently maintaining. The installer installs /native/, 32-bit OCaml 
compilers, that produce /native/, 32-bit windows programs. The OCaml 
native compiler ("ocamlopt") and tools (flexlink) requires a proper 
toolchain to be installed, namely the 32-bit one from the mingw64 
project. This toolchain is impeccably packaged in Cygwin, so the 
installer will advertise the use of cygwin as a development 
environment. Some other tools require the presence of Unix-like 
utilities; OCamlbuild, for instance, requires bash to be available. 
This is also achieved by using Cygwin as a development environment. The 
installer also installs findlib.

The installer does _not_ install any other OCaml library. This is the 
job of a package manager; unfortunately, there is still a long way to 
go on Windows. If I can tweak anything in the installer that would ease 
the life of a package manager, please let me know.

This release fixes several bugs that have been mentioned on this list.
- The Cygwin mirror is no longer hardcoded. The original idea was to 
save the user one more setup screen, where t

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-07-30 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of July 23 to 30, 2013.

1) GODI is shutting down
2) ocaml-lua v1.1: OCaml binding of Lua library
3) Writing Awk in OCaml
4) Lecturer/Senior Lecturer
5) Other Caml News


1) GODI is shutting down
Archive: 

** Deep in the thread spawned last week, Andreas Hauptmann said:

My windows fork (  ) is independent
from Gerd's servers. It won't be affected by the shutdown in September.
If there will be a 4.01 release soon, I intend to publish updated
package informations and binary builds for Windows.

There are not many users. Therefore, I was too lazy to add an own
package release infrastructure (via github or similar). Up to now, the
packages were mainly auto-generated or synchronized from the mainline
repository.
  

2) ocaml-lua v1.1: OCaml binding of Lua library
Archive: 

** Paolo Donadeo announced:

I'm happy to announce a fix release of ocaml-lua, the OCaml binding of the Lua
library. With ocaml-lua you can embed a Lua interpreter in an OCaml program in a
few lines of code, and use Lua for configuration or customization purposes.

Few changes from previous v1.0:

1. bug fixes;
2. support for LuaJIT (2.0.0 for Lua 5.1);
3. compiles on OSX (not much tested, I don't have a Mac at home);
4. support OPAM (package available soon in the official repository, pull request
   already sent);
5. now you can specify a memory limit allocable for the Lua state:
   

Here are some references:

The homepage of the project is hosted on OCaml Forge:


The complete library reference (ocamldoc generated) is here:


Source tarballs are on the download page on OCaml Forge:


The official GIT repository is here:


Bug reports and feature requests are on my page on GitHub:

  

3) Writing Awk in OCaml
Archive: 

** Michael asked and Xavier Leroy replied:

> I am trying to write a Awk in OCaml and would like to write it as a  
> variadic function.  I have seen several examples of variadic functions  
> in OCaml, but I am still unsure if it is possible. Maybe can someone  
> help me to solve this?
> 
> 
> DEFINITION OF (MINI)-AWK
> 
> (Mini)-Awk is a module with the following (probably wrong) signature:
> 
> sig
>type 'a field
>type row = string array
>val make : int -> (string -> 'a) -> 'a field
>val get : 'a field -> row -> 'a
>val bind : (row -> 'a -> 'b) -> 'a field -> row -> 'b
> end
> 
> With this signature [make 1 int_of_string] if a field [f] such that  
> [get f row = int_of_string (row.(1))].
> 
> Now assume you have two fields f1 : int field and f2 : string field  
> and two functions u : int -> state -> state and v : int -> string ->  
> state -> state (where state is a random type).
> 
> With the above signature, we can write (1)
> 
> bind u f1: row -> state -> stat
> bind (bind v f1) f2 : row -> state -> stat
> 
> But it would be quite nice to be able to write the following  
> expressions so that they are defined and correctly type (2):
> 
> bind u f1 : row -> state -> state
> bind v f1 f2 : row -> state -> state
> 
> Is there any way to rewrite things so that the cumbersome (1) can be  
> replaced by the slick (2) ?

Just use a left-associative infix symbol for "bind", it will be real slick:

let (++) = bind

v ++ f1 ++ f2 (* i.e. bind (bind  v f1) f2  *)
  

4) Lecturer/Senior Lecturer
Archive: 

** Conor McBride announced:

The Department of Computer and Information Sciences within the University of
Strathclyde seeks to appoint a Lecturer or Senior Lecturer to enhance the
internationally leading Mathematically Structured Programming (MSP) research
group. The MSP group?s vision is to use mathematics to understand the nature
of computation, and to turn that understanding into the next generation of
programming languages, and the successful applicant will 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-07-23 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of July 16 to 23, 2013.

1) Ubuntu PPAs for OCaml (4.00 and 4.01dev)
2) Batteries 2.1
3) Request for feedback: Procord, a library to delegate tasks to other processes
4) ocamlnet-3.6.6
5) GODI is shutting down
6) Other Caml News


1) Ubuntu PPAs for OCaml (4.00 and 4.01dev)
Archive: 

** Anil Madhavapeddy announced:

I've put together two Ubuntu PPAs to make it more convenient to use modern
OCaml/OPAM versions on Ubuntu via binary packages.

OPAM stable:

This includes the latest stable OCaml (4.00.1) and OPAM (1.0.0).

OPAM unstable:

This includes the latest snapshot of OCaml (4.01.0dev) and OPAM (1.0.1dev).
This should get you reasonably stable snapshot of both, and will include the
release candidates of OCaml when it's released.

For now, these are experimental PPAs as I muddle my way through learning how
Debian packaging works. Reports of breakage or success to me directly would
be appreciated. Most of this PPA was based on the excellent Debian package
sources, and thanks to Mehdid Dogguy in particular for the OPAM packaging.
  

2) Batteries 2.1
Archive: 

** Edgar Friendly announced:

It's been a while since 2.0, and batteries has had a bunch of improvements that
should be shared with a wider audience.

More features, more bugfixes, more batteries.

Thanks to the *many* contributors in this release; batteries exists because of
you.

E.

Changelog:

Added: 
Array.{avg,favg,singleton}, 
Bigarray.of_enum, 
Hashtbl.{modify,modify_def,modify_opt,map_inplace,filter_inplace,filter_opt_inplace},
 
IMap.{modify,modify_def,modify_opt}, LazyList.lazy_fold_right, 
List.{singleton,unfold,min_max,modify,modify_dep,modify_opt, span, nsplit, 
group_consecutive}, 
Map.modify_opt (*3), 
MultiMap.modify_opt (*3), 
MultiPMap.modify_opt (*3), 
Option.{default_delayed , map_default_delayed}, 
Set.find, Set.Incubator.op_map, 
String.rev, 
Substring.{equal,contains,iteri,enum}
Fixed:
Compilation with Ocaml 4.01
Speedup in LazyList.append
More organized magic for fast list snoc
Speedup in String.{replace,nreplace}
Cleanup int32.[un]pack exceptions
Fix last bit access in BatBitSet
Float.round corner case on predecessor of 0.5 fixed
Fix Enum.concat's clone implementation
Fix List.n_cartesian_product to allow empty input
Fix BatText.rfind's index calculation
Improve Pervasives.undefined to be curry-able
Array.backwards doesn't clone array anymore
Remove useless allocation in Splay.cfind
More unit tests, benchmarks
  

3) Request for feedback: Procord, a library to delegate tasks to other processes
Archive: 

** Romain Bardou asked:

I plan on writing yet another library to help with concurrency in OCaml.
The motivations for this library, and the interface I have in mind, are
available here:



Before actually implementing the library, I would be very happy to
receive feedback. I am interested to know, among others:
- whether I miss important information which would make the very
existence of this library stupid (such as, it already exists);
- whether I forgot some important use case;
- whether the names I chose have better ubiquitous equivalents;
- whether you believe I should choose another interface entirely, for
instance, if you don't like functors.
  
** Török Edwin then said and Romain Bardou replied:

> Processing streams of data in parallel without having to read all the data
> in memory first.

Good point. I'm not sure how to deal with this and I actually think it
calls for a slightly different paradigm. Although maybe one could
eventually add send/receive functions to send/receive to/from an 'a
process, and the same for the worker. It would allow to transmit more
than one input and more than one output.

> You could sort of do this with your current interface but only on Unix
> (i.e. mkfifo and pass filename).
> Don't know what'd work on Windows, perhaps creating a (named) pipe, and
> sending the file descriptor to a newly spawned child?

I don't think there are named pipes on Windows but I may be wrong. Maybe
it can be emulated using files anyway. I don't think sending a file
descriptor is a good idea but sending a file name is of course possible.

> Also it'd be nice to have something

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-07-16 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of July 09 to 16, 2013.

1) OCaml-Top release 1.0.0
2) GADTs and associative container
3) Engineering position at Vector Fabrics
4) OCaml 2013 (24/09, Boston): Preliminary program is available
5) enhancements for "perf" on OCaml code
6) Other Caml News


1) OCaml-Top release 1.0.0
Archive: 

** Louis Gesbert announced:

OCamlPro is proud to announce the release of OCaml-Top 1.0.0

OCaml-Top is an interactive editor targeted at education, with a simple and
convenient interface:
an edition panel, with syntax coloration and automatic indentation, tightly
coupled with an ocaml toplevel to easily evaluate the code as you go.

It is available from OPAM and as a binary installer for Windows.

OCaml-Top is released under the terms of the GNU GPL v3.

Home page: 
Source on Github: 

We hope you appreciate it, and it gives a better experience to students and
first-time users, especially on Windows.
  

2) GADTs and associative container
Archive: 

** Goswin von Brederlow asked, Lukasz Stafiniak remarked, and Leo White said:

> > I'm wondering if one can have an ascociative container, like a Hashtbl.t
> > with dependent types (GADTs as the key, value depending on the key).
> > Something like this:
> >
> > module H = struct
> >  type ('a, 'b) t = ('a, 'b) Hashtbl.t
> >  let create : type a b . int -> (a b, a) t =
> > fun x -> Hashtbl.create x
> >  let add : type a b . (a b, a) t -> a b -> a -> unit =
> >fun h k v -> Hashtbl.add h k v
> >  let find : type a b . (a b, a) t -> a b -> a =
> >fun h k -> Hashtbl.find h k
> > end
> >
> > BUT:
> >
> >   let create : type a b . int -> (a b, a) t =
> >   ^^^
> > Error: Unbound type constructor b
> >
> > Is there some special syntax I'm missing or is it simply impossible to
> > declare such a container in the abstract?
>
> I think you need higher kinded types, not GADTs. Haskell has them, 
> for example you can write code that only depends on the type class 
> of "b" (which is parameterized by "a"), and "b" has signature 
> "* -> *" or something like that.

That type is indeed higher-kinded. OCaml does support higher-kinded
types but not in the core type system: you need to use functors.

For example,

> > let create : type a b . int -> (a b, a) t =
> >fun x -> Hashtbl.create x

could be written as:

  module Create (B: sig type 'a t end) = struct
let f x : ('a B.t, 'a) Hashtbl.t = Hashtbl.create x
  end;;

Note that this is not actually the correct type for writing an
associative container. See Jeremy's post for details.
  
** Alain Frisch also suggested:

This thread might of interest to you:


** Jeremy Yallop suggested:

It is indeed possible to create associative containers where the types
of the values depend on the types of the keys.  Let's see what can to
be done to turn the standard hash table into such a container, using
GADTs for keys.

We'll start with the interface.  The standard hash table interface
(Hashtbl.S) looks like this, in part:

module type S =
sig
  type key
  type 'a t
  val create : int -> 'a t
  val add : 'a t -> key -> 'a -> unit
  val remove : 'a t -> key -> unit
  val find : 'a t -> key -> 'a
  val iter : (key -> 'a -> unit) -> 'a t -> unit
end

The type of tables ('a t) is parameterized by the type of values,
since each table holds a single type of value.  We're aiming instead
to have value types depend on key types, so we'll move the type
parameter into the key type.  Making this change mechanically
throughout the interface gives us the following:

module type GS =
sig
  type 'a key
  type t
  val create : int -> t
  val add : t -> 'a key -> 'a -> unit
  val remove : t -> 'a key -> unit
  val find : t -> 'a key -> 'a
  val iter : < f: 'a. 'a key -> 'a -> unit > -> t -> unit
end

Actually, I've made one additional change, in the type of iter.  In
the regular Hashtbl iter function we can get by with ML-style
polymorphism, where all the type variables are implicitly quantified
at the outermost point.  This constrains the function passed to iter
to be monomorphic, which is fine, since regular Hashtbls only support
a single value type.  In our revised interface, however, the function
argument must be polymorphic, since it needs to handle *any* suitable
pairing of keys and values.  The 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-07-09 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of July 02 to 09, 2013.

1) OCamlOScope: a new OCaml API search
2) llpp v16
3) Other Caml News


1) OCamlOScope: a new OCaml API search
Archive: 

** Jun Furuse announced:

I have launched a new OCaml API search, OCaml?Scope at
 .

OCaml?Scope is a type directed library search, derived work from OCaml API
Search by Mizuno and its ancestor OCamlBrowser by Garrigue. It is also
inspired from Hoogle, the same API search engine for Haskell by MItchell,
which I regularly use in my Haskell :-) job.

* Fast and Portable. It loads everything in memory, unlike OCaml API Search
and OCamlBrowser which load compiled interface files (*.cmi) dynamically.
The data file is extracted from compiled files but self-contained, so the
search engine does not require to compile the libraries locally.
* No use of unification but edit distance of types like Hoogle. Unification
does not provide good results in type directed search, and is costy.
* OCamlFind and OPAM friendly. OCaml?Scope knows which items are from which
OCamlFind and OPAM packages.
* OCamlDoc: it also extracts OCamlDoc comments, if possible.
* Small: it can even run as a heroku app. Currently it carries 245k entries
from 76 OCamlFind packages including Core and Batteries, but the data file
(as a marshalled OCaml value) is still 20Mb.

There are lots of todos but I think the search results look well sane so
far. If you find something strange please drop by

and leave some comments. Thanks!
  
** Ashish Agarwal asked and Jun Furuse replied:

It is bit too early since OCamlOScope currently lacks hyperlinks from search
results to the corresponding module/package overviews. But apart from that it
covers lots more modules and packages than OCaml API Search :-)

> Does this supersede search.ocaml.jp? Shall we change the "OCaml API Search"
> link on the front page of ocaml.org?
  

2) llpp v16
Archive: 

** malc announced:

New version of llpp (tagged v16) is now available at


Blurb:

llpp a graphical PDF viewer which aims to superficially resemble
less(1)

Changes:

* Bugfixes
* Better(?) defaults for intel video cards [1]
* Block zooming and point-and-x mode
* Script(llppac) to convert certain types of documents to pdf, cache
  the result and invoke llpp on it

Filters:
+ unoconv for office documents
+ imagemagick for images
+ djvups+ghostscript for djvu
+ ghostscript for ps
+ princexml for html
+ rsvg-convert or inkscape for svg
+ dvipdf for dvi

[1] Looks as if 16bpp depth (i.e. X running with -depth 16) is buggy
though (Mesa3D issue?)
  

3) 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 .

GPU memory model:
  

On the book " OCaml from the very beginning ":
  


Riakc In Five Minutes:
  

OCaml?Scope is now an OCaml heroku app!:
  

  

Old cwn


If you happen to miss a CWN, you can send me a message
([email protected]) 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 at
 .



___
caml-news-weekly mailing list
caml-news-wee

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-07-02 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of June 25 to July 02, 2013.

1) Spoc: GPGPU programming with OCaml
2) Ocaml on windows
3) meetup Paris-OCaml (OUPS) mardi 2 juillet
4) Mixing two GADTs
5) Request for feedback: A problem with injectivity and GADTs
6) Other Caml News


1) Spoc: GPGPU programming with OCaml
Archive: 

** Mathias Bourgoin announced:

I would like to present you a set of tools for GPGPU programming with OCaml.

I developed the SPOC library that enables the detection and use of GPGPU devices
with OCaml using Cuda and OpenCL. I also developed a camlp4 syntax extension to
handle external Cuda or OpenCL kernels as well as a DSL to express GPGPU kernels
from the OCaml code.



This work is a big part of my PhD thesis and was partially funded by the opengpu
project. I'm currently in the UPMC-LIP6 laboratory where I'm supervised by
Pr. E. Chailloux and Pr. J-L Lamotte.

SPOC has been presented several times and the slides and the papers references
are on our website if you want more information about it.  It has currently been
tested on multiple architectures and systems, mostly 64-bit Linux and 64-bit OSX
systems. It should work with Windows too (I tested it successfully last year
with Windows 7...).

To be able to use SPOC, you'll need a computer capable of running OCaml
(obviously) but also compatible with either OpenCL or Cuda.  For Cuda you only
need a current proprietary NVidia driver while for OpenCL you need to install
the correct OpenCL implementation for your system.  SPOC should compile anyway
as everything is dynamically linked, but you'll need Cuda/OpenCL eventually to
run your programs.

SPOC currently lacks a real tutorial, it comes with some examples and I strongly
advise anyone interested to look into the slides and papers on the website.


By the way, if you are interested and if you are in Paris next week, I will be
presenting SPOC etc. during the "OCaml Users in PariS" (OUPS) Meetup next
Tuesday (July 2) .

I hope to see some of you there and to have some feedback on this work.

Mathias

SPOC : 
OpenGPU : 
OUPS : 
  

2) Ocaml on windows
Archive: 

** Alain Frisch continued this thread from last week:

> I am looking to develop a desktop application which will be distributed
> to customers, so for now I think I will need ocaml libs like wxwidget,
> batteries, sql lite db library, sockets, networking etc.
> Is anyone using omake on windows? Does it have a dependency on Cygwin
> like ocamlbuild?

LexiFi uses omake on Windows and Linux.  It does not depend on Cygwin 
itself, if you are careful enough to not use any Cygwin tool in the 
build rules, of course.  omake actually implements a decent scripting 
language (with built-in versions of some useful tools).

FWIW, we use a tool (  ) to interact easily 
with the .Net framework, allowing our application to access .Net 
components.  For instance, our Windows GUI is based on .Net Windows 
Forms and we use the .Net driver from Oracle.  (For PostgreSQL, we use 
Markus' ocaml bindings to the native libpq library.)
  

3) meetup Paris-OCaml (OUPS) mardi 2 juillet
Archive: 

** Fabrice Le Fessant announced:

A short message in French, to give the program of the next OCaml-Paris meetup,
tomorrow Tuesday, July 2, at 19:30 at IRILL :

La prochaine rencontre du Meetup OCaml-Paris (OUPS) aura lieu le mardi 2
juillet, à l'IRILL, comme d'habitude, et devrait mettre l'accent sur des
expériences de programmation en OCaml dans divers contexte.

Au programme, à partir de 19h30 :
- "Les GADT dans la pratique" (Pierre Chambart ou Gabriel Scherer)
- "Programmation GPGPU en OCaml" (Mathias Bourgoin)
- "Utiliser Js_of_ocaml pour enrichir une page web" (Çagdas Bozman)
- "Expériences de contribution à Batteries" (Gabriel Scherer)

Comme d'habitude, nous nous retrouverons ensuite pour discuter autour de
boissons et de bonnes pizzas, offertes par LexiFi !

Inscrivez-vous nombreux !


  

4) Mixing two GADTs
Archive: 
-

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-06-25 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of June 18 to 25, 2013.

1) 0.3 release of dolog
2) The HoTT book
3) Anonymous sum types in functors
4) Ocaml on windows
5) Other Caml News


1) 0.3 release of dolog
Archive: 

** François Berenger announced:

A new version is available in OPAM:
# opam list dolog
dolog 0.3 the dumb, but colorful, OCaml logger

The only new feature is that logging levels
can be colored in unix terminals.

The feature is turned off by default
(for compatibility, because it won't
work everywhere and also because it is a little toyish).

The API is there:

  

2) The HoTT book
Archive: 

** Oliver announced:

The HoTT book


  

3) Anonymous sum types in functors
Archive: 

** David Allsopp asked:

I couldn't think of a better way to describe what I'm trying to do, so
forgive the possibly strange subject!

In:

module IntSet = Set.Make(struct type t = int let compare = compare end)

the resulting signature is:

sig
  type elt = int
  type t
  ...

but in:

module FlagSet = Set.Make(struct type t = A | B let compare = compare end)

the resulting signature is:

sig
  type elt
  type t
  ...

i.e. the constructors are hidden (I can see why, but presumably it is a
special case in the type checker?) and the module is essentially useless. I
don't want to define the type external to the module - the idea is that I'd
be able to write Flag1Set.add Flag1Set.CommonFlag Flag1Set.empty and
Flag2Set.add Flag2Set.CommonFlag Flag2Set.empty, etc.

I can work around this by writing:

module FlagSet =
  struct
type flag = A | B
include Set.Make(struct type t = flag let compare = compare end)
  end

where the resulting signature is:

sig
  type flag = A | B
  type elt = flag
  type t
  ...

but I'm wondering:

a) Is there a way to do it where you can end up with type elt = A | B (I
think the answer is no?)

b) Is there a syntactically lighter way to write the module definition?
  
** Xavier Leroy replied:

> a) Is there a way to do it where you can end up with type elt = A | B (I
> think the answer is no?)

No, because that wouldn't quite respect the generativity of sum type
definitions, but you can get close, see below.

> b) Is there a syntactically lighter way to write the module definition?

I would recommend naming your anonymous "struct":

module Flag = struct
  type t = A | B
  let compare = compare
  (* Other useful operations over flags, e.g. *)
  let to_string = function A -> "A" | B -> "B"
end

module FlagSet = Set.Make(Flag)

Then you get

FlagSet: sig
  type elt = Flag.t
  type t
  ...
end

The good thing about this solution is that it gives you a natural
place to put additional operations over flags, like "to_string" above,
shall you ever need them.

> the idea is that I'd
> be able to write Flag1Set.add Flag1Set.CommonFlag Flag1Set.empty and
> Flag2Set.add Flag2Set.CommonFlag Flag2Set.empty, etc.

Why not "Flag1Set.add Flag1.CommonFlag Flag1Set.empty"? Flags morally
come from Flag1, not from Flag1Set.

As an aside, some ML-like module systems require functor arguments to
be module names or paths, e.g. Coq's. OCaml accepts anonymous structs
as arguments, and does the best it can with them, but if the struct
contains generative type definitions, some information is necessarily
lost.
  
** Jacques Garrigue also replied:

Xavier described the official solution.
However, since 3.12 you can also do some trickery.
This is going to be heavier, so this is probably a bad idea, but if you really 
need it, here it is:

module FlagSet = struct
  type elt = A | B
  include (Set.Make (struct type t = elt let compare = compare end) : Set.S 
with type elt := elt)
end
  

4) Ocaml on windows
Archive: 

** Bikal Gurung asked:

I am looking to use ocaml to implement a project for my employer. However, the
environment is Windows OS. I am using cygwin and so far it seems to work but
curious on experiences others have on using ocaml on windows - both as a
development and deployment platform. Also has anyone tried using opam on
windows? Does it work?
  

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-06-18 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of June 11 to 18, 2013.

1) pareto -- OCaml statistics library
2) Ocamlnet-3.6.5
3) Real World OCaml beta1 available
4) Other Caml News


1) pareto -- OCaml statistics library
Archive: 

** Sergei Lebedev announced:

I'm working on a statistics library for OCaml, called 'pareto' [1]. My goal was
to cover all of the features available in Brian O'Sullivan's 'statistics' [2]
library, which seems to be pretty popular [3] in Haskell community. Here's a
list of what's currently implemented:

* Common statistical tests for significant differences between samples
(Student's t test, chi^2 test, Mann Whitney U-test, Wilcoxon signed-rank test,
binomial sign test).
* Uniform interface for common discrete and continuous probability
distributions.
* Sample statistics, quantile estimation, kernel density estimation.
* Resampling methods: jackknife, BCa bootstrap.

See 'examples/'[4]directory on GitHub for usage examples.

Any feedback is appreciated!

--Sergei

[1] 
[2] 
[3] 
[4] 
  

2) Ocamlnet-3.6.5
Archive: 

** Continuing this old thread, oliver announced:

the ocamlnet-package on AUR (Arch Linux) was orphaned.
I adopted it and updated to 3.6.5:


  

3) Real World OCaml beta1 available
Archive: 

** Anil Madhavapeddy announced:

Yaron Minsky, Jason Hickey and I are pleased to announce the beta release of
our forthcoming O'Reilly book, called "Real World OCaml", available online at


The book is split into three parts: language concepts, tools and techniques,
and understanding the runtime. As promised last year, we are making a public
beta available for community review and to help us hunt down inaccuracies and
find areas that need more clarification.

We've had the book in closed alpha for six months or so and have developed a
feedback system that uses Github to record your comments. This lets us follow
up to each review with clarifications and keep track of our progress in fixing
issues. During alpha, we've received over 1400 comments in this fashion (and
addressed the vast majority of them!). However, since we anticipate more
comments coming in from a public beta, we would request that you read the FAQ
to avoid drowning us in repeat comments: 

(TL;DR followup another comment on Github directly if you can instead of
creating a new issue via the web interface)

This release is available in HTML format online at:


O'Reilly is currently preparing a Rough Cuts release that will make the beta
available as PDF and in popular eBook formats. We anticipate that this will
be available later this week, and I'll send a followup when that happens.

Finally, we would especially like to thank our alpha reviewers. Their feedback
() has been invaluable
to the beta release. The book also includes substantial contributions to
individual chapters from Jeremy Yallop (FFI), Stephen Weeks (GC) and Leo White
(objects).

If you have any comments that you'd like to send directly by e-mail, please
contact us at
rwo-authors AT recoil.org.

Release notes for beta1:

* The first-class modules chapter is incomplete, pending some portability
  improvements to the ocaml-plugins Core library.
* The binary serialization chapter is also incomplete, but has just enough
  to teach you about the Async RPC library.
* The installation chapter will be revised in anticipation of the OCaml 4.1
  release, and is currently quite source-based.
* The packaging and build systems chapter hasn't been started yet. We're
  still deciding whether or not to make this an online pointer rather than
  a print chapter, since it's likely to change quite fast.
* We are preparing exercises per chapter that are not included in this
  particular beta release, but will be available online as soon as possible.
* The code examples will all be clonable as a separate repository in beta2.
  

4) Other Caml News
---

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-06-11 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of June 04 to 11, 2013.

1) Ocamlnet-3.6.5
2) post-doc position at MSR-Inria
3) ocaml-ctypes, a library for calling C functions directly from OCaml
4) Core Suite 109.27.00 + core_kernel
5) OCaml on zLinux
6) Use-site variance in OCaml
7) New Book: OCaml from the Very Beginning
8) Deadline extension: OCaml 2013, new deadline on June 18 (anywhere on earth)
9) Findlib-1.4
10) Other Caml News


1) Ocamlnet-3.6.5
Archive: 

** Amending the announcement from last week, Gerd Stolpmann said:

Well, things go wrong...

There was a build problem in 3.6.4 so that netstring-pcre did not work
properly. This is fixed in the new versiopn 3.6.5 I just released.

Gerd

> Hi,
>
> I've just released Ocamlnet-3.6.4. This is a maintenance release
> including:
>
> - New configure options for PCRE (-enable-full-pcre, -enable-pcre).
> There is also documentation about the PCRE issue in Regexp.html
> (remember that PCRE is no longer the default regexp engine).
> - More documentation for Netmulticore: Netmcore_basics
> - New Netplex module for mailboxes: Netplex_mbox.
> - netcgi2-apache builds against apache-2.4
>
> plus various smaller fixes and additions.
>
> For a full description, see the ChangeLog.
>
> Get Ocamlnet, read the manual etc. from
> 
  

2) post-doc position at MSR-Inria
Archive: 

** Damien Doligez announced:

Research team: Tools for Proofs, MSR-INRIA Joint Centre
===

The Microsoft Research-INRIA Joint Centre is offering a 2-year
position for a post-doctoral researcher to contribute to the ADN4SE
project aiming at extending the proof development environment for TLA+
developed in the Tools for Proofs project
() and applying it for
the verification of key components of a real-time operating system.


Research Context


TLA+ is a language for specifying and reasoning about systems,
including concurrent and distributed systems. It is based on
first-order logic, set theory, temporal logic, and a module system.
TLA+ and its tools have been used in industry for over a decade. More
recently, we have extended TLA+ to include hierarchically structured
formal proofs that are independent of any proof checker. We have
released several versions of the TLAPS proof checker
() and integrated it into the
TLA+ Toolbox, an IDE for the TLA+ tools
().

TLAPS and the Toolbox support the top-down development of proofs and
the checking of individual proof steps independently of the rest of
the proof. This helps users focus on the part of the proof they are
working on. Although it is still under active development, TLAPS is
already a powerful tool and has been used for a few verification
projects, in particular in the realm of distributed algorithms
(e.g.,
).

TLAPS consists of the Proof Manager (PM, an interpreter for the
proof language that computes the proof obligations corresponding to
each proof step) and an extensible list of backend provers. Current backends
include the tableau prover Zenon, an encoding of TLA+ as an object logic
in the Isabelle proof assistant, and a generic backend for SMT solvers.
When possible, we expect backend provers to produce a detailed proof that
is then checked by Isabelle. In this way, we can obtain high assurance
of correctness as well as satisfactory automation.

The current version of the PM handles only the "action" part of TLA+:
first-order formulas with primed and unprimed variables, where a
variable v is considered to be unrelated to its primed version v'.
This allows us to translate non-temporal proof obligations to standard
first-order logic, without the overhead associated with an encoding of
temporal logic into first-order logic. An extension for handling full
TLA+, including its temporal logic for verifying liveness properties,
is currently being developed.


Description of the activity of the post-doc
===

The post-doctoral position is funded by the PIA ADN4SE project
() that
develops a real-time operating system and development tools for
embedded systems based on PharOS. The system aims at providing
certifiable correctness and performance guarantees, and core protocols
of the oper

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-06-04 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of May 28 to June 04, 2013.

1) OPAM and packaging
2) ~/.opam design
3) opam packages wrapped inside a spec file
4) A modern meta programming system for OCaml
5) Interfacing with QtQuick 2.0 from Qt5, RFC
6) Ocamlnet-3.6.4
7) automatic extaction of the .mli (and a little more) from the .ml
8) Other Caml News


1) OPAM and packaging
Archive: 

** Very deep in this thread, Chet Murthy said and Christophe Troestler replied:

> OK.  A little more.  OPAM is already a tremendous improvement.  But to
> really make it possible to build -systems- in Ocaml, you have to be
> able to distribute collections of programs, config, and libraries,
> across multiple (admittedly identical) machines.  And distribute
> updates to same.  OPAM is in some ways like BSD ports -- it works
> great for maintaining single machines from source-code.
> 
> But what's needed is a way to maintain -many- machines, and to
> distribute updates in a granular manner that be -managed- -- rolled
> forward, rolled back, with full knowledge of which versions of which
> packages are being installed.  And everything with -zero- version
> skew.  So any nondeterminism happened at buiild-time -- by
> deploy-time, all machines are getting identical files with identical
> timestamps.
> 
> It's a tall order, b/c OPAM will need to figure out how to capture
> enough of the environment (in order to check it on the target machine
> where a binary is installed) to verify whether it's safe to install
> that binary.  But boy would it be nice.
> 
> And as a bonus, we could wrapper opam in the debian apparatus (I
> think) and get a really nice way to turn opam packages into debian
> packages.

Those interested in that should help Sylvain to develop oasis2debian¹
and other helpers.  Oasis has rich metadata and can be the "root" from
which packages are created (there is also oasis2opam² which usually
performs a better job than humans ;-) ).

¹ 
² 
  
** Thomas Gazagnaire then added:

We are indeed in the process of experimenting with that idea (see [1]).
Nothing is ready yet, but that's definitely something we are interested in.

The hard part is (as always) to keep track of the correct external
dependencies (such as the available shared C libraries available at the time
of build). A good first approximation is to say that the external
dependencies never change, but that's obviously not very safe to rely on that
assumption too much, so we are thinking of keeping track of the result given
by ldd as well.

[1] 
  

2) ~/.opam design
Archive: 

** Sébastien Dailly asked and Thomas Gazagnaire replied:

> Maybe is the subject now closed, and I'm answering too late, but I'll
> greatly appreciate if opam could follow the XDG Directory design[1] :
>
> $XDG_CONFIG_HOME/opam (default ~/.config/opam) for the configuration
> $XDG_DATA_HOME/opam (default ~/.local/opam) for the package and all datas
>
> This allow to stop the polution in the users ~ , and give the user a way to
> define it's own path.
>
> [1] 

The subject is not closed at all, and we might move in this direction in
future releases of OPAM. See for instance [1]

The current design has a lot of advantages (the main one being that you can
remove your ~/.opam if you want restart from scratch) and it can be tweaked
to have a global installation (see [2,3], even if the tweak is not very well
documented). But yes, for some configurations (such as shared NFS homedirs),
the current situation is not perfect and it would be nice to be able to
separate the data from the configuration bits. Luckily, all the paths used by
OPAM are defined in [4] so they can be changed without too much hassle.

[1] 
[2] 
[3] 
[4] 
  

3) opam packages wrapped inside a spec file
Archive: 

** Florent Monnier said, Francois Berenger asked, and Florent Monnier replied:

>> For fun I've played with wrapping an opam package inside a rpm packag

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-05-28 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of May 21 to 28, 2013.

1) French study on security and functional languages
2) OPAM: installing batteries pa_strings.
3) Other Caml News


1) French study on security and functional languages
Archive: 

** David Mentré said:

For those reading French, ANSSI (French agency for information
security) published a study on security and functional languages, with
a set of recommendations. OCaml is apparently well studied:



"""
Cette étude, menée par un consortium composé de Saferiver, Normation,
AMOSSYS et du CEDRIC dans le cadre formel d?un marché du SGDSN, avait
pour objectif principal d?étudier l?adéquation des langages
fonctionnels pour le développement d?applications de sécurité, de
proposer le cas échéant des recommandations, et de mettre en pratique
certaines de ces recommandations.
"""
  
** Fabrice Le Fessant said:

Some comments on this topic:

- LaFoSec is the second study funded by ANSSI (it was done by a consortium
of experts, among which many security experts and one of the main
developers of OCaml, so I would not take their recommendations
lightly, personally), the first one is JavaSec (
),
so there is indeed a comparison between OCaml, other functional languages,
and imperative languages, showing that there are many more security
 problems with Java than with OCaml.

- LaFoSec was started in 2010, which explains why it focuses on OCaml 3.12.

- If some observations seem obvious (for smart people that you are ;-) ), a
lot of them are much less obvious (the fact for example that you can
discover a secrete key using polymorphic comparisons without breaking the
type system). Also, they give an interesting set of arguments for pushing
OCaml instead of other programming languages, so for me, they are really
going in the good direction, it's a very good thing for the OCaml community.

- There is a document that was also written, but has not been published (it
was described at the last JFLA'2013 seminar, also in French), providing a
set of recommendations to improve OCaml for security applications. I don't
know why it was not published with the other ones, maybe because it would
become obsolete faster than the other ones.
  
** Olivier Levillain also said:

For information, some of the results have been presented last February
during the JFLA (Journées francophones des langages applicatifs). The
slides presented are available on the conference web site
().
  
** Anil Madhavapeddy said and Olivier Levillain replied:

> I was very glad to see the release of the Parsifal code onto Github too:
> 
>
> It looks like you have done a lot of the work required towards building
> a pure OCaml SSL and Kerberos stack, as well as DNS and SSH parsers in
> there too. We were just discussing the lack of a pure OCaml SSL library
> for MirageOS (which already has a full reimplementation of device drivers
> and TCP/IP and HTTP, and is just missing the final SSL piece).

I'm glad to see you are interested in Parsifal. It was recently
published on GitHub and will be presented as a short paper at SSTIC 2013
(, not to be confused with SSTiC 2013).

However, this is still a project in development and I must warn you it
was first written to allow for writing quick and robust *parsers*. That
is why for the moment, the code essentially consists in the description
of some formats and protocols. We are beginning to work on animating
the protocols, but this will need a lot of work to get done properly.

Concerning the protocols you cite, here is the status :
- nearly all SSL/TLS messages and X.509 certificates are supported and
some test tools already exist (but only for the first handshake round-trip);
- Kerberos as you see it in the repository is at a very early stage but
more commits are coming once I have time to review them;
- DNS is working and I wrote a picodig version to make some requests
(but this one was easy: there is no real context in the protocol);
- We have not yet worked on SSH but it would be a good idea.
  

2) OPAM: installing batteries pa_strings.
Archive: 

** Ivan Gotovchits asked and Gabriel Scherer replied:

> It seems that I'm the only person in the Internet

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-05-21 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of May 14 to 21, 2013.

1) ocaml-bitstring 2.0.4
2) standard 3d vector library in OCaml
3) concurrent caml-light?
4) 2D vector graphics
5) Core Suite 109.23.00 + async_parallel
6) Other Caml News


1) ocaml-bitstring 2.0.4
Archive: 

** Richard Jones announced:

bitstring is a library for manipulating bitstrings, binary file
formats, protocols, etc from OCaml.



The list of changes is here:


  

2) standard 3d vector library in OCaml
Archive: 

** Continuing this thread from last week, Florent Monnier asked and Francois 
Berenger announced:

> I would enjoy to see your library.

It's in OPAM now under the name vector3.
  

3) concurrent caml-light?
Archive: 

** Chet Murthy asked and François Boisson replied:

> Does anybody know whatever happened to concurrent caml-light? Anybody
> have any idea if the Doligez-Gonthier-Leroy GC was ever implemented in
> another system?

Yes, Camllight is on 0.82-3 version. I tried to maintain it.
You can find debian and ubuntu package on

deb  wheezy divers

(change wheezy with squeeze, quantal, precise, raring and so on)

and source on

* cvs of INRIA
* deb-src  ./
* 
  
** Xavier Leroy also replied:

> Anybody have any idea if the Doligez-Gonthier-Leroy GC was ever
> implemented in another system?

Yes, for Java, at IBM Haifa (of all places):

Tamar Domani, Elliot K. Kolodner, Ethan Lewis, Eliot E. Salant, Katherine
Barabash, Itai Lahan, Yossi Levanoni, Erez Petrank, Igor Yanover: Implementing
an On-the-Fly Garbage Collector for Java. ISMM 2000: 155-166


later extended with generations:

Tamar Domani, Elliot K. Kolodner, Erez Petrank: A generational on-the-fly
garbage collector for Java. PLDI 2000: 274-284

  

4) 2D vector graphics
Archive: 

** Deep in this thread, Francois Berenger said and Florent Monnier added:

> By the way, I just saw in OPAM that there are bindings
> to cairo, which looks quite nice for 2D vector graphics.

There's even "Caboodle" a mini-puzzle game that uses it,
which is very simple but interesting as an example of what we can do with it.

For Mageia Linux users, just install it with:
$ su - -c "urpmi caboodle"
$ caboodle

If you don't have any package for your distro, you may want to get our
patches from:

before to compile it.

Or more minimalist examples on Rosetta:


For 2D accelerated graphics, you may also appreciate SFML 2.0,
there are 2 usable bindings: ocaml-sfml and ocsfml.
Both are good for the 2.0 version of SFML that was just released
several days ago.
  

5) Core Suite 109.23.00 + async_parallel
Archive: 

** Jeremie Dimino announced:

I am pleased to announce the 109.23.00 release of the Core suite.

The following packages were upgraded:

- async_parallel
- core
- core_extended
- jenga

async_parallel is a new library.  It is for running tasks in other
processes on a cluster of machines.  A detailed description is
included in the API documentation:

  

Files and documentation for this release are available on our website
and all packages are in opam:

  
  

Here are the changelogs for versions 109.15.00 to 109.23.00:

# 109.15.00

## async_extra

- In `Rpc.client` and `Rpc.with_client`, allowed the client to
  implement the rpcs.

  Added a new optional argument: `?implementations:_ Client_implementations.t`.
- Added new module `Versioned_rpc.Both_convert` 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-05-14 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of May 07 to 14, 2013.

1) extlib 1.5.4
2) standard 3d vector library in OCaml
3) Linux epoll bindings
4) an issue with coercing private types
5) Interfacing with QtQuick 2.0 from Qt5, RFC
6) String, Array, Bigarray.char
7) smarter #load directive
8) New OCaml-Paris meetup on May 21, 19h30, IRILL
9) oasis help: support for qtest in oasis
10) Other Caml News


1) extlib 1.5.4
Archive: 

** ygrek announced:

New release of extlib is out - fixing installation problems only.
Get it as usual at 
  

2) standard 3d vector library in OCaml
Archive: 

** Francois Berenger asked:

Is there a standard library for this purpose?

Maybe I should relase mine, I have a small one.
  
** Francois Berenger replied:

I would enjoy to see your library.

Especially if some functions are usable for OpenGL.
Here is bellow what I'm using for OpenGL.
This is not a vector lib but a matrix lib tailored for use with
forward compatible OpenGL.
It only contains 2 or 3 (not-optimised) functions for vectors computations.







But this current revision 94 in the svn is not my more advanced version.
The more recent version is not in the svn because it's C code rewriten
in OCaml and the original code was provided under a more restrictive
license than the one of glMLite (MIT), and I don't want to downgrade
to (L)GPL.

Someone told me that I should not bother about this issue and that
this kind of code should be considered as only math.




If your lib contains things useful for OpenGL I would be pleased to
integrate these parts in my module Ogl_matrix, or maybe even create a
new one Ogl_vector.
(But only if your license is MIT or similar)
  
** Daniel Bünzli also replied:

It's not standard, unreleased and I hate to pre-announce but in the following
months I plan to release Gg, a module that gives you basic types for 2D and
3D computer graphics; vectors, matrices, quaternions, axis-aligned boxes,
colors and raster data.

Vectors and matrices are abstract but represented internally as records of
floats. This allows to pass them directly to C functions that take double
arrays and avoids bounds checking in OCaml code. The memory layout of
matrices is also the one expected by OpenGL.

Except for the Raster module --- metadata for bigarrays to allow libraries to
share raster data without depending on each other e.g. an OpenCV or image
loading library and an OpenGL library --- the module is pretty stable now, it
still needs a final code review though and one or two function names may
change.

The current documentation of gg can be found here [1], the code can be
browsed here [2]. It can also be installed via the erratique-unstable opam
repo:

opam repo add erratique-unstable

opam update
opam install gg

But I'd advise you not to that until the next release of opam because of this
bug [3] which while harmless makes your `opam update` experience become
unpleasant (you have to do a `opam remove gg`, before being able to `opam
update`).

Comments are welcome.

Best,

Daniel


[1] 
[2] 
[3] 
  
** rixed also replied:

For what it's worth, I also did a small 2d vector library[1] some time ago in
order to learn some OCaml while doing something fun. What might be of interest
is that it was able to read font outlines from truetype files, and some non
trivial triangulation algorithm was implemented. If someone is interrested it
could be a good thing to "port" this with this upcoming Gg lib (instead of my
own slower and certainly less elegant vector module).

[1]: 
  
** Francois Berenger added:

By the way, I just saw in OPAM that there are bindings to cairo, which looks
quite nice for 2D vector graphics.
  

3) Linux epol

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-05-07 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of April 30 to May 07, 2013.

1) OCaml mechanize?
2) -principal
3) Request for feedback: A problem with injectivity and GADTs
4) Other Caml News


1) OCaml mechanize?
Archive: 

** Continuing the thread from last week, Richard Jones said:

> There are bindings to Perl's WWW::Mechanize in perl4caml. Its website
> seems down,

The latest code is in the git repo:


  

2) -principal
Archive: 

** Yaron Minsky asked and Jacques Garrigue replied:

> Can anyone describe the pluses and minuses of turning on -principal?
> Is it considered to be good practice for codebases that are compatible
> with it?  Can it change behavior of currently working code?

Turning on -principal allows detecting "risky" uses of type information to
help type inference.
By risky I mean that success or failure of type inference may depend
on the order in which subexpressions are typed.
This kind of type information is only used by a limited number of features:
* polymorphic methods
* using different order of labeled arguments in a function
* some discarding of optional arguments
* choice of the source type in a coercion (i.e. automatic upgrading of
   (expr :> t2) into (expr : t1 :> t2) when the type of expr is closed).
  This is particularly useful for private type abbreviations.
* GADTs
* disambiguation of record field and constructor names (new in trunk)

The technical definition is based on polymorphism, but the intuition
is that type information follows the (functional) flow of data, even going
through polymorphic functions (being conservative when merging flows).
So a simple way to understand is: supposing that type annotation physically
adds type information to the expression they decorate, will all values
reaching the use point be decorated?
It also flows backward (the expected type is propagated), but does not
go through functions in that case.

# type t = < id: 'a. 'a -> 'a >;;
type t = < id : 'a. 'a -> 'a >
# let f (x : t) = x, x#id;; (* safe code: the type of x is known at all its 
use points *)
val f : t -> t * ('a -> 'a) = 
# let f x = (x : t), x#id;; (* unsafe code: the type is only known because 
typing goes from left to right *)
Warning 18: this use of a polymorphic method is not principal.
val f : t -> t * ('a -> 'a) = 
# let f x = x#id, (x : t);;(* just exchanging the members of the pair 
causes a failure *)
Error: This expression has type < id : 'a; .. >
   but an expression was expected of type t
   The universal variable 'a0 would escape its scope

In an ideal world, I would suggest systematically using -principal, as it makes
the notion of "known type" well-defined.
However, there are drawbacks to -principal
* type inference is slower (more copying occurs)
* cmi's become bigger
The first point is mainly a problem if you use objects.
The second one if you have already problems with cmi size (again, mostly 
objects)

As a result the suggested approach is to only compile with -principal once in a 
while.
This is reasonable because if compiling with -principal works, in theory it is 
guaranteed
that the program will be accepted without -principal too. Of course the 
semantics do
not change.

However there is a difficulty: since the generated cmi's may differ, in general 
one
has to maintain completely separate builds.
If you have a complete set of mli's, then a solution is to always compile mli's 
with
(or without) -principal. (Compiling the mli without principal may in theory 
cause
propagation to fail in some cases, but you are on the safe side, and I have
never observed it)

So yes, it is good practice. But I'm afraid few invested the effort in doing it.
Looking at the features you use in Core, this may be a good idea to try.
(My understanding is that Lexifi tried, but they had problems because they
use big object types).
By the way, the ocaml compiler itself doesn't use any of the above features,
so it is not directly concerned.
  

3) Request for feedback: A problem with injectivity and GADTs
Archive: 

** Continuing the thread from last week, Jacques Garrigue said:

Ironically, I have just found that lablgtk2 does not compile with the fixed 
version.
lablgtk2 does not use GADTs, but it uses constrained type parameters in classes.

The problem is as follows:

go

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-04-30 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of April 23 to 30, 2013.

1) first release of dolog: the dumb ocaml logger
2) ackermann microbenchmark strange results
3) OCaml-Java & concurrent programming: request for feedback
4) OCaml mechanize?
5) Request for feedback: A problem with injectivity and GADTs
6) Book reviewers wanted
7) Thematic trimester "Semantics of proofs and certified mathematics", spring 
2014, Paris
8) Other Caml News


1) first release of dolog: the dumb ocaml logger
Archive: 

** Francois Berenger announced:

After an 'opam update', you should be able to see the dolog package.

Here is its minimalistic interface definition:
---
type log_level = FATAL | ERROR | WARN | INFO | DEBUG

val set_log_level : log_level -> unit
val set_output : out_channel -> unit

val fatal : string Lazy.t -> unit
val error : string Lazy.t -> unit
val warn : string Lazy.t -> unit
val info : string Lazy.t -> unit
val debug : string Lazy.t -> unit
---

The full source code can be found here:



The license is a BSD one.

I believe the more complete logging alternative
is Xavier Clerc's Bolt ().
  

2) ackermann microbenchmark strange results
Archive: 

** ygrek asked:

Got some time scratching my head over this little puzzle.
Consider this bog-standard ackermann code :

let rec ack m n =
  match m, n with
  | 0,n -> n+1
  | m,0 -> ack (m-1) 1
  | m,n -> ack (m-1) (ack m (n-1))
in let _ = ack 4 1 ()

One could also pass m and n as a tuple. Also the call to the actual computation
can be a toplevel let or not.  All in all 4 variants. Can you predict what will
be the performance and what is the difference (if any) in generated code?

All code and Makefile is attached.

Running `make bench` here consistently gives the following (ack1, ack3 - tuples,
ack2, ack4 - curried) :

ack1.ml
0:03.85

ack2.ml
0:04.70

ack3.ml
0:04.60

ack4.ml
0:03.85

Tested with 3.12.1 and 4.00.1 (ack4 becomes slower).

Moreover, the generated assembly code for the main loop is the same, afaics.
The only difference is the initialization of structure fields and the initial
call to ack. Please can anybody explain the performance difference? I understand
that microbenchmarks are no way the basis to draw performance conclusions upon,
but I cannot explain these results to myself in any meaninful way.
Please help! :)
  
** Many people replied, including Xavier Leroy:

As others said, probably code placement. A good tool to explore these
issues under Linux is "perf", in particular "perf stats", which lets
you count various hardware events. Running it on your 4 programs,
you'll see that the number of instructions executed is almost exactly
the same, but the branch mispredictions (for instance) vary
significantly, in a way correlated with the overall execution time.

(Note that this doesn't have anything to do with OCaml: you'd observe
crazy variations like these with any compiled language.)

> I understand that microbenchmarks are no way the basis to draw
> performance conclusions upon, but I cannot explain these results to
> myself in any meaninful way.

Nobody can except perhaps a few engineers at Intel or AMD who have the
whole microarchitecture of their processors imprinted in their heads.
(And then they will not tell you.) See, modern microarchitectures
contain so many clever heuristics that performance is generally very
good but essentially unpredictable...

rixed AT happyleptic.org
adds:

> Remember me of a paper I read some years ago that was measuring the
> effect of the various optimisation levels of gcc against the effect
> of addresses choices (randomised using environment strings of
> various lengths!), and which conclusion was that the effect of -O3
> compared to -O2 was less than the effect of "choosing" a good
> environment string :-) Couldn't find it again using Google ; maybe
> someone remember this paper?

It's probably "Producing Wrong Data Without Doing Anything Obviously
Wrong!" by Diwan et al, ASPLOS 2009,

This paper made quite a splash in the compiler community...
  

3) OCaml-Java & concurrent programming: request for feedback
Archive: 

** Xavier Clerc:

The OCaml-Java is a project whose goal is to allow compilation
of OCaml sources to Java bytecode, thus allowing exe

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-04-23 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of April 16 to 23, 2013.

1) first release of dolog: the dumb ocaml logger
2) Other Caml News


1) first release of dolog: the dumb ocaml logger
Archive: 

** Francois Berenger announced:

After an 'opam update', you should be able to see the dolog package.

Here is its minimalistic interface definition:
---
type log_level = FATAL | ERROR | WARN | INFO | DEBUG

val set_log_level : log_level -> unit
val set_output : out_channel -> unit

val fatal : string Lazy.t -> unit
val error : string Lazy.t -> unit
val warn : string Lazy.t -> unit
val info : string Lazy.t -> unit
val debug : string Lazy.t -> unit
---

The full source code can be found here:



The license is a BSD one.

I believe the more complete logging alternative
is Xavier Clerc's Bolt ().
  

2) 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 .

April Monthly Report:
  

My thesis is out!:
  

Non-determinism and sequence points in C:
  
  

Old cwn


If you happen to miss a CWN, you can send me a message
([email protected]) 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 at
 .





___
caml-news-weekly mailing list
[email protected]
http://lists.idyll.org/listinfo/caml-news-weekly


[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-04-16 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of April 09 to 16, 2013.

1) Functional Programming at Jane Street
2) try...finally , threads, stack-tracebacks  in ocaml
3) Build number and date in OCaml?
4) Microsoft-funded PhD opportunity (software/ system verification)
5) Merlin 1.0 released
6) modified error messages for ocamlc
7) OCaml 2013 - Call for presentations
8) Other Caml News


1) Functional Programming at Jane Street
Archive: 

** Yaron Minsky:

Jane Street is looking to hire functional programmers for our offices
in New York, London and Hong Kong.

Jane Street has the largest team of OCaml developers in any industrial
setting, and the world's largest OCaml codebase. We use OCaml for
running our entire business, working on everything from statistical
research to systems administration to automated trading systems. If
you're interested in using OCaml to solve real-world problems, there's
no better place.

Jane Street is an informal and intellecutal place --- you'll get to
work with an extremely talented group of developers and traders (a
pretty geeky group in its own right), pushing the bounds of functional
programming and learning about the business of trading.

We have a strong commitment to OCaml and to open-source software.
We've continue to develop and release our own open source software, as
well as support OCaml Labs and OCamlPro in building out the language
infrastructure.

Compensation is more than competitive, and no prior experience with
finance is required.

Here are some resources you can use to learn more about Jane Street
and what we do.

- A talk I gave at CMU about how and why we use OCaml

- Our technical blog: 
- Our open-source site: 

You can apply here:


  

2) try...finally , threads, stack-tracebacks  in ocaml
Archive: 

** Chet Murthy asked and, after many replies, Jacques-Henri Jourdan said:

> People have previously asked about try...finally support in Ocaml, and
> it's been observed (correctly) that you can write a little combinator
> to give you this support, e.g.
>
> let finally f arg finf =
> let rv = try Inl(f arg) with e ->
> Inr e
> in (try finf arg rv with e -> ());
> match rv with
> Inl v -> v
> | Inr e -> raise e
>
> The problem is, you discard stack-traceback when you rethrow the
> exception. One can program around this explicitly by capturing the
> backtrace string and appending it to the rethrown exception, but it's
> cumbersome and won't work for exceptions like Not_found that are
> already defined without a mutable string slot.
>
> It sure would be nice of ocaml had try...finally that preserved the
> traceback information properly  though maybe it isn't possible.
> Certainly in the case where the finally block doesn't raise any
> exceptions itself (even those that are caught silently), it seems like
> it ought to be possible.

I recently published a blog post proposing a solution to the backtrace
problem of Ocaml. It includes a Camlp4 filter and a small Ocaml library
to handle exception backtraces. The performance drawback is negligible
when backtraces are not activated, and reasonable when they are.

You can read about it here :


  

3) Build number and date in OCaml?
Archive: 

** Étienne André asked:

I've been using OCaml for a couple of years, but without using any
advanced feature; so my question may be a little naive. Is there any
way to insert easily the current date and time of compiling, as well
as, e.g., an incremental build number in an OCaml program? So that it
is printed at runtime, e.g., in the program header.

I quite stupidly used the Unix.gettimeofday() function before
realizing that it is of course executed at runtime.

Of course, I could do it using an external script that would modify
the OCaml source code before compiling, but is there any native OCaml
feature for achieving this in a cleaner manner?
  
** Julien Signoles suggested:

This kind of information is part of your build process and are not
directly accessible in OCaml. If you want to access it in your OCaml
program, you have to pass them from the build environment to the
program environment. As Jeremie Dimino said, the usual wa

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-04-09 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of April 02 to 09, 2013.

1) OUD2013 part of CUFP?
2) new user - old questions
3) Job offer: compilation of synchronous languages for multicore 
safety-critical systems
4) Vector Fabrics is hiring!
5) First release of P3: a combinator parser library, and parser generator
6) Other Caml News


1) OUD2013 part of CUFP?
Archive: 

** Deep in this thread, Anil Madhavapeddy said among other things:

Let me sample some of the videos from the CUFP website (at
)

* Scala at Twitter

* Facebook Chat in Erlang

* Freebase and Metaweb in OCaml (now part of Google)

* Scheme for games development in Uncharted 3

* F# at Microsoft for biological computing


* Big data at Nokia using Erlang/OCaml:


And I haven't even mentioned our usual friends from Citrix or Jane Street:
* 
* 

And many more, of varying size and impact: there's been an interesting
evolution from the 'bedroom FP user' to large companies that use it without
blinking an eye. All of this has been tracked by CUFP over the years,
although we unfortunately don't have videos from the earliest ones.
  

2) new user - old questions
Archive: 

** Lukasz Stafiniak replied to this very old thread:

> Some years ago I was looking for adequate language for one open-source
> project to be done in free time and although I took a look at OCaml,
> somehow, I didn't like syntax and went playing with Haskell.
>
> Never really grokked monads and had feeling that despite nice syntax,
> some things are more complicated for pragmatic programming than they
> should be.

[shameless plug] If you'd like to revisit monads and learn other cool
stuff, have a look at "Functional programming in OCaml"

  

3) Job offer: compilation of synchronous languages for multicore 
safety-critical systems
Archive: 

** Albert Cohen announced:

The PARKAS team at INRIA and École Normale Supérieure in Paris is
looking for an engineer or a postdoctoral researcher.


This is a 2 to 3 years position, offered in the context of the FSF
project of the IRT SystemX laboratory, to work on a functional,
synchronous language for the design and implementation of multicore
embedded controllers. The position starts on May 15th and is based
primarily in Saclay (NanoInnov building, CEA), with the likely option to
relocate at the INRIA offices in Paris if preferable.

The unique configuration of the SystemX laboratory enables the effective
collaboration of academic and industry researchers and engineers. Direct
collaboration and transfer with Alstom Transport and Esterel
Technologies is expected in this context. The work will include the
development of a compiler for a variant of the Lustre language, building
on existing components in OCaml, as well as runtime system components
for safety-critical and real-time execution environments.

Please contact me as soon as possible if you are interested. More
information will be provided upon request.

Feel free to forward this offer to people you know who might be interested.
  

4) Vector Fabrics is hiring!
Archive: 

** Stefan Holdermans announced:

Vector Fabrics is hiring: we are looking for a top-notch programmer to
extend our program-analysis and parallelization products. You design
and implement algorithms to assist the programmer to create a parallel
design from a sequential C or C++ program. You work with our
international team of world-class compute

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-04-02 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of March 26 to April 02, 2013.

1) Yypkg mingw-builds 1.2b1 - 70 Windows 32/64 packages, OCaml cross-compiler
2) Master-slave architecture behind an ocsigen server.


1) Yypkg mingw-builds 1.2b1 - 70 Windows 32/64 packages, OCaml cross-compiler
Archive: 

** Adrien Nader announced:

I'm pleased (and much relieved) to announce a new version of the yypkg
mingw-builds. Together with yypkg, this provides a package manager both
on Linux and on Windows with 70 packages of libraries and binaries built
both for i686 and x86_64. Everything is easily fully reproducible.

Release highlights include:
- New x64 toolchain (both as a cross- and native toolchain)
- Improved native toolchains
- OCaml cross-compiler, only targets i686-w64-mingw32 (see bug 5737)
- More packages
- Updated packages
- Installers for Windows

You can find details, documentationa and downloads on the new website:


PS: you can also read/write comments and vote on reddit if you feel like
it's worth it:


  
** He later added:

I've put a new version (1.2 RC1) which fixes the issues I had found in
beta1. The documentation and the binaries are updated; there are small
fixes here and there (mostly in the doc even though there is still room
for improvements).

The address hasn't changed and you can find everything on yypkg.org:


As before, I've submitted it to reddit. Unlike before, I haven't been
blocked by its spam filter.

   
  

2) Master-slave architecture behind an ocsigen server.
Archive: 

** Philippe Veber asked:

I'm developping an ocsigen website doing some scientific calculations.
Up to now, the calculations were done in the same process that runs
the server. In order to gain in scalability (and maybe stability too),
I would like to run those calculations in a separate (pool of)
process(es). As this is a pretty typical setup, I guess quite a few
people have already done that. So I'd like to hear some suggestions on
what library to use in this particular context. It seems to me that
the release library [1] should do the job and is lwt-friendly, but
there are maybe other good options?

Thanks for any hint, cheers!

Philippe.

[1] 
  
** Martin Jambon suggested:

I wrote and used a library called Nproc about a year ago. It lets you
create (Nproc.create) a pool of N processes, to which you can submit
(Nproc.submit) computations of any type quasi-magically - just make
sure any big environment required for the computation is not copied
with each closure that you send to the workers. The submodule
Nproc.Full provides a more advanced interface that lets each worker
process have its own local environment.



I haven't used Nproc in a while but it was working fine and should
still work.
  
** Philippe Veber then said and Alain Frisch replied:

> nproc meets exactly my needs: a simple lwt-friendly interface to
> dispatch function calls on a pool of processes that run on the same
> machine. I have only one concern, that should probably be discussed on
> the ocsigen list, that is I wonder if it is okay to fork the process
> running the ocsigen server. I think I remember warnings on having parent
> and children processes sharing connections/channels but it's really not
> clear to me.

FWIW, LexiFi uses an architecture quite close to this for our
application. The main process manages the GUI and dispatches
computations tasks to external processes. Some points to be noted:

- Since this is a Windows application, we cannot rely on fork.
Instead, we restart the application (Sys.argv.(0)), with specific
command-line flag, captured by the library in charge of managing
computations. This is done by calling a special function in this
library; the function does nothing in the main process and in the
sub-processes, it starts the special mode and never returns. This
gives a chance to the main application to do some global
initialization common to the main and sub processes (for instance, we
dynlink external plugins in this initialization phase).

- Computation functions are registered as global values. Registration
returns an opaque handle which can be used to call such a function. We
don't rely on marshaling closures.

- The GUI proces

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-03-26 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of March 19 to 26, 2013.

1) Case study in optimization: porting a compiler from OCaml to F#
2) Oregon Programming Languages Summer School - call for participation
3) Other Caml News


1) Case study in optimization: porting a compiler from OCaml to F#
Archive: 

** Deep in this thread, Roberto Di Cosmo said:

We are quite happy that Parmap is useful in your applications,
and would love to know more about your use cases.

Btw, I uploaded to HAL an author version of the article published in Procedia
Computer Science, so that everybody can access the paper ... it is
available at


  

2) Oregon Programming Languages Summer School - call for participation
Archive: 

** Amal Ahmed announced:

This year's Oregon PL Summer School will take place from July 22nd to
August 3rd. The registration deadline is April 16th. Full information
on registration and scholarships an be found here:

   

The school has a long and successful tradition (sponsored by the NSF,
ACM SIGPLAN, and industry). It covers current research in the theory
and practice of programming languages. Material is presented at a
tutorial level that will help graduate students and researchers from
academia or industry understand the critical issues and open problems
confronting the field. Prerequisites are an elementary knowledge of
logic and mathematics, as covered in undergraduate classes on discrete
mathematics, and some knowledge of programming languages at the level
of an undergraduate survey course.

A new feature this year is a Coq boot camp session, to be held on July
21st -- one day before the summer school officially begins. The boot
camp will provide a one-day, intensive, hands-on introduction to the
practical mechanics of the Coq proof assistant. More information is
available at the summer school website.


This year's program is titled Types, Logic, and Verification. The
speakers and topics include:

Amal Ahmed -- Logical Relations
Northeastern University

Robert Harper -- Type Theory Foundations
Carnegie Mellon University

Dan Licata -- Dependently-Typed Programming in Agda
Carnegie Mellon University and Institute for Advanced Study 

Greg Morrisett -- Coq as a Programming Language
Harvard University

Simon Peyton-Jones -- Adventures with Types in Haskell
Microsoft Research

Frank Pfenning -- Linear Logic and Session-based Concurrency
Carnegie Mellon University

Andrew Tolmach -- Software Foundations in Coq
Portland State University

Stephanie Weirich -- Designing Dependently-Typed Programming Languages
University of Pennsylvania

Steve Zdancewic -- Verifying LLVM Optimizations in Coq
University of Pennsylvania

We hope you can join us for this excellent program.

Amal Ahmed
Zena Ariola
Bob Constable
Frank Pfenning
Benjamin Pierce
OPLSS 2013 organizers
  

3) 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 .

The failures of Debian (and its derivatives):
  


Stog 0.8.0:
  

OCamlRSS 2.1.0:
  
  

Old cwn


If you happen to miss a CWN, you can send me a message
([email protected]) 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 at
 .



___
caml-news-weekly mailing list
[email protected]
http://lists.idyll.org/listinfo/caml-news-weekly


[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-03-19 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of March 12 to 19, 2013.

1) Case study in optimization: porting a compiler from OCaml to F#
2) OPAM 1.0.0 released !
3) Use of OCaml in universities and engineering schools
4) Riakc 0.0.0
5) Core Suite 109.14.00 released + custom_printf
6) Other Caml News


1) Case study in optimization: porting a compiler from OCaml to F#
Archive: 

** Jon Harrop said:

There has been some discussion here about the implications of single- vs
multi-threaded garbage collectors and, in particular, their performance in
the context of the kinds of metaprogramming that OCaml has traditionally
been used for.

I recently ported a compiler written in OCaml to the F# programming language
for a client and performance turned out to be an issue so I'd like to
present this as a case study to provide some real data. Unfortunately I
cannot disclose precise details.

The original compiler was 15kLOC of OCaml code. The amounts of DSL code that
it consumes and C code that it produces can be considerable and compilation
can take minutes. Consequently, performance is valued by my client's
customers and, therefore, the original code had been optimized for OCaml's
performance characteristics.

A direct translation of the OCaml code to F# proved to be over 10x slower.
This was so slow that it impeded testing my translation so I did some
optimization early. Specifically, profiling indicated that the biggest
problem was the high rate of exceptions being raised and caught. Exceptions
are around 600x slower on .NET than in OCaml so this can quickly degrade
performance. I changed all of the hot paths to use union types (usually
option types) instead of exceptions, according to F# idioms. Although this
incurs a lot of unnecessary boxing in F# the performance improvements were
substantial and the F# version became 5x slower than the OCaml.

On a related note, thorough testing showed that my almost-blind translation
of 15kLOC of code was completely error free. I think this is a real
testament to the power of ML's static type system. The only error I have
introduced so far occurred when I was replacing the use of an exception in a
function with a union type.

After demonstrating the correctness of the translation, my effort turned to
trying to improve performance in an attempt to compete with the original
OCaml code. I had believed that this could well prove to be prohibitively
difficult or even impossible because symbolic code is OCaml's main strength.
However, I have managed to make the F# around 8x faster than it was and, in
particular, substantially faster than the original OCaml.

So this non-trivial symbolic code base has not had its performance suffer
from the adoption of a multicore-friendly garbage collector.
  
** Julien Verlaguet asked and Jon Harrop replied:

> Thanks for sharing this case-study with us!

No problem. I found it in my drafts folder. :-)

> Have you tried parallelizing the OCaml version?

No. I didn't touch the OCaml code at all.

> I am thinking pre-forked processes communicating with pipes?

That would work but it would be a lot of effort compared to
Array.Parallel.map in F#.

> We write a lot of large-scale static-analysis in OCaml here at Facebook.

Good to hear. :-)

> Parallelizing them with pre-forked processes gave us very good
performances.

I'm not sure how much message passing would be required in this case and
don't have time to investigate.

> I would be curious to see a case-study of pre-forked OCaml vs threaded F#.

Me too. Only problem is that fork-based parallel OCaml code takes a long
time to write in comparison. Incidentally, the F# does not make direct use
of threads.
  
** Pierre-Alexandre Voye then suggested:

So you could maybe use Parmap.map ?
Parmap.parmap ~ncores:4 funct (Parmap.L elem_list)
  
** Jon Harrop replied and Jean-Marc Alliot said:

We have been using Parmap and are quite happy with it (we use it as an
alternative to the Ocaml/MPI implementation when MPI is not strictly
required), with excellent scalability on our applications (even if we
had to change from time to time a little bit or our code, regarding
the fact that Parmap does not allow "in place" modifications).

> What happens if the inner function returns results via mutation? I
> assume you must rearrange the code to return all results explicitly
> and they will then be deep copied (which destroys scalability due to
> limited shared memory bandwidth on multicores).

As fas as I can tell there is no "copy" of any form. Parmap only
collects results. If you do "in place" modifications, they are lost.
Parmap is, in a way, "functional"...

> Does it do load balancing? I assume not given that ncores is
> hardcoded.

There is an optional argument (chunksize) to man

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-03-12 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of March 05 to 12, 2013.

1) Commercial Users of Functional Programming 2013
2) OPAM mailing-lists ERRATUM
3) Barista 2.0-beta release
4) A brief guide to a bit of the OCaml type checker
5) llpp v15
6) [ocamlgraph] Johnson's algo, C-bindings, GraphML reader, edge dominators
7) If you distribute oasis' setup.ml with your software, please use a recent 
(>= 0.3.0) version of Oasis
8) OpenGL Ocaml mailing-list
9) Other Caml News


1) Commercial Users of Functional Programming 2013
Archive: 

** Thomas Gazagnaire announced:

This year, CUFP 2013 will be in Boston (and it is still co-located with ICFP 
2013).
If you use OCaml (or any other functional language) for practical 
applications, then you should consider applying!



COMMERCIAL USERS OF FUNCTIONAL PROGRAMMING 2013
CUFP 2013

CALL FOR PRESENTATIONS
Boston, MA, United States
Sep 22-24
Talk Proposal Submission Deadline 29 June 2013
Co-located with ICFP 2013
Sponsored by SIGPLAN

The annual CUFP workshop is a place where people can see how others
are using functional programming to solve real world problems; where
practitioners meet and collaborate; where language designers and users
can share ideas about the future of their favorite language; and where
one can learn practical techniques and approaches for putting
functional programming to work.

Giving a CUFP Talk
==

If you have experience using functional languages in a practical
setting, we invite you to submit a proposal to give a talk at the
workshop. We are looking for both experience reports and
in-depth technical talks.

Experience reports are typically 25 minutes long (but negotiable), and
aim to inform participants about how functional programming plays out
in real-world applications, focusing especially on lessons learned and
insights gained. Experience reports don't need to be highly technical;
reflections on the commercial, management, or software engineering
aspects are, if anything, more important.

Technical talks are also 25 minutes long (also negotiable), and should
focus on teaching the audience something about a particular technique
or methodology, from the point of view of someone who has seen it play
out in practice. These talks could cover anything from techniques for
building functional concurrent applications, to managing dynamic
reconfigurations, to design recipes for using types effectively in
large-scale applications. While these talks will often be based on a
particular language, they should be accessible to a broad range of
programmers.

If you are interested in offering a talk, or nominating someone to do
so, send an e-mail to marius(at)twitter(dot)com or
sperber(at)deinprogramm(dot)de or by 29 June 2013 with a short
description of what you'd like to talk about or what you think your
nominee should give a talk about. Such descriptions should be about
one page long.

There will be a short scribes report of the presentations and
discussions but not of the details of individual talks, as the meeting
is intended to be more a discussion forum than a technical
interchange. You do not need to submit a paper, just a proposal for
your talk! Note that we will need all presenters to register for the
CUFP workshop and travel to Boston at their own expense.

Program Committee
=

Marius Eriksen (Twitter, Inc.), co-chair
Mike Sperber (Active Group), co-chair
Mary Sheeran (Chalmers)
Andres Löh (Well-Typed)
Thomas Gazagnaire (OCamlPro)
Steve Vinoski (Basho)
Jorge Ortiz (Foursquare, Inc.)
Blake Matheny (Tumblr, Inc.)
Simon Marlow (Facebook, Inc.)

More information


For more information on CUFP, including videos of presentations from
previous years, take a look at the CUFP website at
. Note that presenters, like other attendees, will need
to register for the event. Presentations will be video taped and
presenters will be expected to sign an ACM copyright release
form. Acceptance and rejection letters will be sent out by July 16th.

Guidance on giving a great CUFP talk


Focus on the interesting bits: Think about what will distinguish your
talk, and what will engage the audience, and focus there. There are a
number of places to look for those interesting bits.

Setting: FP is pretty well established in some areas, including
formal verification, financial processing and server-side
web-services. An unusual setting can be a source of interest. If
you're deploying FP-based mobile UIs or building servers on oil
rigs, then the challenges of that scenario are worth focusing
on. Did FP help or hinder in adapting to the setting?

Technology: The CUFP audience is hungry to learn about how 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-03-05 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of February 26 to March 05, 
2013.

1) Brand-new BER MetaOCaml for OCaml 4.00.1
2) Core Suite 109.11.00 released + ocaml_plugin
3) Research Assistantship at Oxford on Bidirectional Transformations
4) Other Caml News


1) Brand-new BER MetaOCaml for OCaml 4.00.1
Archive: 

** Continuing an old thread, Anil Madhavapeddy announced:

Thanks to Cedric Cellier packaging it up and sending us a pull request [1],
you can try our MetaOCaml BER straight from OPAM via:

$ opam update
$ opam switch 4.00.1+BER
$ eval `opam config env`
$ ocaml...

-anil

[1] 
  

2) Core Suite 109.11.00 released + ocaml_plugin
Archive: 

** Jeremie Dimino announced:

I'm pleased to announce the 109.11.00 release of the Core suite. We
are now distributing the ocaml_plugin project, which aims at making
dynlink more easier. It offers a high-level API where the user can get
a first class module out of a few ml source files, the compilation
being handled automatically.

ocaml_plugin has been tested only on Linux, but we plan to make it usable
on other platforms as well.

Files and documentation are available on our website and all packages
are in opam:

  
  

Changelogs for versions 109.08.00 to 109.11.00:

# 109.08.00

## async_extra

- Added module `Async.Command`
  This is `Core.Command` with additional async functions.  In particular
  it contains a function `async_basic` that is exactly the same as
  `Core.Command.basic`, except that the function it wraps returns
  `unit Deferred.t`, instead of `unit`.  `async_basic` will also start the
  async scheduler before the wrapped function is run, and will stop the
  scheduler when the wrapped function returns.

## async_unix

- Added module `Async.Process`
  This is a new module for creating and dealing with child processes.
- For `Writer.save`, replaced the `temp_prefix` argument with `temp_file`.
- Added `Ivar.invariant` function.
- Added value `Scheduler.fold_fields`
  This lets one fold over the fields in the scheduler, eliminates an
  annoying place in catalog browser that reached into the internals of
  async to compute the sizes of the scheduler fields

## core

- Cleaned up and updated the `README`.
- Changed executables to enable backtraces if `OCAMLRUNPARAM` is not set.
- Changed `Command` so that executables show build info and version info
  This happens when an executatble is called as:

foo.exe version

  Before this change, rather than display build info, executables
  would display the not-so-helpful:

  (no option given - printing version)
- Added back `Float` rounding functions with a hardcoded direction.
- Exposed `with bin_io` and `with compare` for the =sexp_bool= type.
- Added value `Core.Never_returns.sexp_of_t`.
- Added values `Or_error.tag{,_arg}`
  These are analogous to `Error` functions of the same name.
- Added functor `Sexpable.Of_sexpable`
  This is for serializing values of one type as though it were some
  other isomorphic type.
- Added module `Backtrace.Exn`
  This exposes OCaml stdlib's `Printexc` functions for backtraces.
- Added module `Flags`
  This implements Unix-style sets of flags that are represented as an
  `int` with various bits set, one bit for each flag, e.g.,
  `Linux_ext.Epoll.Flag`.
- Added module `Uuid`
  This module implements universally unique identifiers based on version
  3 of the UUID specification.  It used to be in `Core_extended=`
- Added module `Type_equal`, which defines the "equality" GADT.

## type_conv

- Fixed type_conv to stop dropping parens in arguments such as:

type t = {
  a : int with default(1), sexp_drop_if(fun x -> (x + 1) * 2 = 4)
} with sexp

# 109.09.00

## async

- Switched `Async.Std`'s toplevel bindings for `Deferred.Or_error`'s
`bind` and `map` to use
  `Deferred.Result`.
  This allows them to be used with any `'error` type, rather than just
`Error.t`.

## async_core

- Fixed bug in `Async.Throttle`, in which jobs weren't started in order.

## async_unix

- Added module `Thread_safe_pipe`, for streaming data outside async into async.
  This a more efficient and feature-ful way to send a sequence of values
  from outside async into async than `Thread_safe.pipe`, which has been
  eliminated.
- Changed functions in `Thread_safe` to always wake up the scheduler.
  Changed `Thread_safe.run_in_async{,_exn}` to not run a cycle, and
  instead rely on the schedu

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-02-26 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of February 19 to 26, 2013.

1) llpp v13
2) Beta-release of Merlin
3) Extracting information from HTML documents
4) strange typechecking result
5) What is triggering a lot of GC work?
6) Other Caml News


1) llpp v13
Archive: 

** malc announced:

New version of llpp (tagged v14) is now available at


Blurb:

llpp a graphical PDF viewer which aims to superficially resemble
less(1)

Changes:

* Bugfixes
* Keyboard handling imrpovements (keypad, Neo layout, altgr)
* Some functionality to make integration with synctex easier
(shift click, -remote command line option)
  

2) Beta-release of Merlin
Archive: 

** Frédéric Bour announced:

We are very pleased to announce the beta release of Merlin. Merlin is a tool
which provides smart completion, among other things, in your favorite editor.
As of today, Vim and Emacs are supported.

See it at work:


Its features include:
- completion of values, constructorsand modules based on local scope
- retrieving type of identifiers and/or expressions under cursor
- integration of findlib to manage buildpath
- highlighting of syntax errors, type errors and warnings inside the editor
- to a certain amount, resilience to syntax and type errors

It works only with Ocaml 4.00.1 (may works with newer versions).

If you happen to have an opam installation with the right version
(opam switch 4.00.1), you can try it right away with:

$ opam remote add kiwi  
 
$ opam install merlin

Then to get started and set-up your editor:
- 
- 

Check it out at: 

The current version still needs to be tested under various systems and
configurations, your feedback is welcome.
  
** Gabriel Scherer then said:

I looked into Merlin in the last few days, so here is a bit more
information if you, like me, are interested in design information
about projects before deciding whether to use (and potentially
contribute to) them.

Interface-wise: using Merlin (at least on emacs) feels a lot like
ProofGeneral (or CoqIde): there is a "checked zone" from the start of
the buffer to the first error, and reliable type information is
available in all this checked zone. The interface is rather simple and
easy to use.

(If you're considering porting Merlin to another editor: merlin is an
OCaml program that inputs and outputs JSON queries, so it seems rather
easy to port to any editor having plugin support in any language with
JSON support. Given its youth, you should however expect Merlin's
protocol to evolve over the next development period, so editor plugin
developers would need to follow Merlin's internal changes for now.)

The major difference between Merlin and -annot-based tools such as
Ocamlspotter or Typerex2 is that Merlin does the work of parsing OCaml
sentences into chunks and sending them incrementally to the
type-checker, instead of sending the whole buffer at once and using
the output. This means that Merlin is much more robust with respect to
files that have errors and cannot be compiled as a whole: you'll get
reliable type information from the start of the file upto the first
error (and some resilience heuristic to have more after). The OCaml
type-checker is in fact able to provide some typing information even
for incorrect programs, so -annot-based tools do support some of those
features, but in a less reliable and more coarse-grained way.

The design trade-off is that Merlin has to copy/adapt more logic from
the compiler: it embeds an OCaml parser derived from the compiler's
one (you won't get parsing bugs as with regexpy elisp modes), and
currently also copies and slightly modifies the type-checker (I hope
this can be changed in the future, possibly by adding some flexibility
to the type-checker regarding eg. production of warnings). This means
more maintenance work to port Merlin to future OCaml versions. On the
other hand, it's probably not reasonable to expect the compiler
type-checker to be re-engineered for optimal incrementality support,
so having an external implementation of incrementality that piggybacks
on the batch typer interface makes sense.

My personal intuition is that Merlin's design is a good long-term
choice for an editor service (as opposed to code-analysis services).
You want tools such as ocamldoc, dead cod

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-02-19 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of February 12 to 19, 2013.

1) ocp-indent 1.0.0 release
2) Old and new OCaml installed on same machine?
3) Sequence 0.3.1
4) Other Caml News


1) ocp-indent 1.0.0 release
Archive: 

** Continuing the thread from last week, Louis Gesbert announced:

Thanks for all the feedback and few bug reports during the past week of beta-
test.

We can now announce the 1.0.0 release of ocp-indent, available on opam.
  

2) Old and new OCaml installed on same machine?
Archive: 

** Oliver asked and Francois Berenger replied:

> any ideas on how to manage multiple OCaml-installations
> on one machine, without running into trouble?
> 
> I have 3.11.2 here on my old Ubuntu box.
> I built OCaml 4.00, but stopped before the "make install",
> because on a target system (a server providing my web stuff)
> there also is 3.11.2 installed (older Debian system), and I'm
> not root at that system.
> 
> But I want to compile my code there also.
> So I may need to develop in two branches for a while
> and do merges.
> 
> When I remove my 3.11.2, the testing would need me to work
> on the remote machine, when testing the old-branch (the merges).
> Possible, but more effort (and network delays are annoying).
> 
> Can more than one OCaml be installed and used in an easy way?
> Or should I forget this issue because of "mission impossible"
> or because of "that needs too much effort"?

I think you are looking for the opam -switch option.
It allows to "jump" from one version to another.
  

3) Sequence 0.3.1
Archive: 

** Simon Cruanes announced:

I'm happy to announce the release of Sequence 0.3.1. Sequence is
designed to compose iterations over containers in a lightweight fashion.
The goal is to transfer values between containers, or to apply
transformations (map, filter, take, etc.) on several values without
caring about where they come from. It doesn't have any dependencies.

Sequence is not designed to be as general-purpose or flexible as, say,
Batteries' `Enum.t`. Rather, it aims at providing a very simple and
efficient way of iterating on a finite number of values, only allocating
(most of the time) a few intermediate closures to do so.

For instance, if you have an array and want to build a hashtable that
contains elements mapping to their index in the array, you can write:

> #require "sequence";;
> let a = [| "a"; "b"; "c"; "d"; "e" |];;
> let h = Hashtbl.create 3;;
> Sequence.hashtbl_add h
(Sequence.map (fun (x,y) -> y,x)
(Sequence.of_array_i a));;
> open Format;; (* to print h *)
> let pp_pair formatter (x,y) = fprintf formatter "%s -> %i" x y;;
> Sequence.pp_seq pp_pair std_formatter (Sequence.of_hashtbl h);;

A toy S-expression module, and a few tests are included but not compiled
by default (because they require OCaml >= 4.0). The code is free (BSD
license), hosted at  and available on
OPAM (install with `opam install sequence`).
  

4) 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 .

Four:
  

Some great news on Opa:
  

Reactive ML 1.08.04:
  
  

Old cwn


If you happen to miss a CWN, you can send me a message
([email protected]) 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 at
 .



___
caml-news-weekly mailing list
[email protected]
http://lists.idyll.org/listinfo/caml-news-weekly


[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-02-12 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of February 05 to 12, 2013.

1) OCaml Platform - Mailing List
2) Memoize GADT
3) ocp-indent beta release
4) Core Suite 109.08.00 released
5) OCaml Labs Monthly Update
6) OMonad 0.2
7) OCaml tests on Travis CI
8) geany as an ocaml ide
9) ReactiveML 1.08.04
10) Other Caml News


1) OCaml Platform - Mailing List
Archive: 

** Amir Chaudhry announced:

As some of you may be aware from the Consortium meeting, there's an
ongoing project to create an OCaml Platform. The Platform will combine
the core OCaml compiler distribution from INRIA with a comprehensive,
coherent set of libraries, tools, documentation, and other resources.
For example, the OPAM package manager will play a central role in both
packaging and distribution, as well as supporting continuous
integration testing.

This email is to let you know that we've set up a mailing list to
discuss the Platform (platform  lists.ocaml.org), and those who
are interested can follow the day-to-day discussions there [1]. Any
important announcements, including releases, would also be copied to
the caml-list when appropriate, so you don't need to join if you only
want updates.

Best wishes,
Amir

[1] 
  

2) Memoize GADT
Archive: 

** Christophe Papazian asked and Alain Frisch replied:

> this must be a very basic question for some of you, sorry for the 
> inconvenience :
> 
> When I have function "f" of type (a -> b), I can easily add a layer to
> that function to memoize the result by using a (a,b) Hashtbl.t to
> store the results of the expensive to compute "f".
> 
> let mf = let e = Hashtbl.create 0 in ( fun x -> try Hashtbl.find e x with 
> Not_found -> let res = f x in Hashtbl.add e
> x res; res )
> 
> But now, I have a function "g" 
>   let g (type a) : a gadt -> a = 
> 
> And If I apply the same method, type a becomes weak (_'a).
> 
> Is there something simple to memoize that function as easy as the
> previous example and keep its polymorphism ? I think not, but I hope
> to be wrong.

We have encountered exactly the same problem recently.  A slightly more 
general version of your question is how to memoize a function of type

   'a t -> 'a s

for two type parametrized constructors t and s (and similarly with 
higher arities).  We want an hash table which can hold key/value 
bindings ('a t * 'a s) for any 'a.  The equality of keys must be such 
that when (key1 : 'a t) is equal to (key2 : 'b t), we can deduce that 'a 
and 'b are the same type (i.e. the value must hold enough information to 
deduce the type from the content), which guarantees that 'a s and 'b s 
are also the same type (and so the existing value associated to key1 can 
be returned for key2).  This assumption often holds when 'a t is a GADT 
representing "expressions which evaluate to values of type 'a".

Our solution (implemented by my colleague Sebastien, in Cc:) has been to 
create a functor with the following signature:

==
module type ParametricType = sig
   type 'a t
end

module ParametricEquality : sig
   type (_, _) t =
 | Eq: ('a, 'a) t
 | Ne: ('a, 'b) t
end

module type ParametricHashedType = sig
   type 'a t
   val equal: 'a t -> 'b t -> ('a, 'b) ParametricEquality.t
   val hash: 'a t -> int
end

module ParametricHashtbl : sig
   module type S = sig
 type 'a key
 type 'a value
 type binding = Binding: 'a key * 'a value -> binding
 type t
 val create: int -> t
 val clear: t -> unit
 val reset: t -> unit
 val copy: t -> t
 val add: t -> 'a key -> 'a value -> unit
 val remove: t -> 'a key -> unit
 val find: t -> 'a key -> 'a value
 val find_all: t -> 'a key -> 'a value list
 val replace: t -> 'a key -> 'a value -> unit
 val mem: t -> 'a key -> bool
 val length: t -> int
 val iter: (binding -> unit) -> t -> unit
 val fold: (binding -> 'a -> 'a) -> t -> 'a -> 'a
   end
   module Make(X:ParametricHashedType)(Y:ParametricType): S with type 'a 
key = 'a X.t and type 'a value = 'a Y.t
end
==

Note that the first input of the function (ParametricHashedTyped) looks 
like the standard argument to Hashtbl.Make, except that the equality 
function returns a dynamic witness of equality between 'a and 'b in case 
of equality between two values of types 'a t and 'b t.  This is 
implemented using a GADT.  We also use a GADT to introduce an 
existential on 'a for key/value pairs of type 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-02-05 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of January 29 to February 05, 
2013.

1) OCaml-Java: new preview
2) Core Suite 109.07.00 released
3) ocurl forked and 0.5.4 released
4) multiplexing several threads
5) Brand-new BER MetaOCaml for OCaml 4.00.1
6) Update on docs.camlcity.org
7) Other Caml News


1) OCaml-Java: new preview
Archive: 

** Xavier Clerc announced:

In order to support some of the claims made during the OUPS meetup,
I made a new binary preview of the OCaml-Java project, available at
the following address:


The next versions will also be made available on the very same page,
without notification to the OCaml mailing list (at least until the distribution
is binary-only).

I am still eagerly looking for testers... and bug reports.
  
** Rudi Grinberg asked and Pierre Chambart suggested:

> It would be really sweet to be able to install ocamljava through opam.
> Something along the lines of opam switch ocamljava.

You can try
opam remote add

opam switch ocamljava-preview

But do not expect any package to work.
  

2) Core Suite 109.07.00 released
Archive: 

** Jeremie Dimino announced:

I'm pleased to announce the 109.07.00 release of the Core suite of
libraries.  Core is an industrial strength alternative to OCaml's
standard library.

Tarballs can be found here:

  

And the documentation:

  

All packages are available through opam.

** The Core suite **

The Core suite includes a variety of useful libraries, including:

- Core: the heart of the standard library.
- Several useful syntax extensions
  - type-conv: a library for building type-driven syntax extensions
  - sexplib: a library for handling s-expressions, and a syntax
extension for auto-generating conversions between OCaml types and
s-expressions
  - bin-prot: a syntax-extensions for generating
  - pipebang
  - variantslib
  - comparelib
  - fieldslib
- Async: a monadic concurrency library.
- Core_extended: extra components that are not as closely vetted or as
  stable as Core.  This includes, Shell, an interface for interacting
  with the UNIX shell, and Command, a command-line parsing library.

** Repositories **

The official repositories for the Core libraries are now located on
the "janestreet" organisation on github and the "janestreet" team on
bitbucket.

github:
bitbucket: 
github home page:  

We changed the way we are exporting our source tree; there will now be
only one visible commit per release and project. Hopefully this
simpiflied process will allow more frequent updates.

** Contribution **

If you want to contribute to core the preferred way is to submit a
pull-request, which won't be merged in the end but will be used for
working on the changes before they are accepted and added to our
development process for integration in a future release.

** Changes **

He is a list of changes since the previous public release (108.08.00):

- Switched to OCaml 4.0.
- Async:
  - Add a [~perm] argument to [Writer.open_file] to set the file
permissions in the same way [Unix.openfile] does.
  - Added [Async.Unix.unsetenv].
  - Fixed a bug in [Reader] that in some situations would make the
reader unusable after an error in user code (e.g. a failed sexp
conversion).
  - Fixed a bug in [Writer] that manifests when scheduling bigstrings
with non-zero pos parameter.
  - Fixed a bug in [Scheduler.go], which previously behaved incorrectly
if an exception had been raised to the main monitor prior to
[Scheduler.go] being called.  The exception is now dealt with
immediately, rather than running a cycle.
  - Exposed the type and value [Async.Config.t] as sexpable.
  - Improved error message when a user requests async to manage a file
descriptor that it is already managing.
  - Improved error message when creation of the async scheduler fails.
  - Added [val _squelch_unused_module_warning_] to [Async.Std].
  - Made [Reader.load_sexp{,s}] handle exceptions other than
[Of_sexp_error].
  - Fixed a bug in async's handing of file descriptors -- a missed check
for a file descriptor having been closed.
  - Added [Writer.set_buffer_age_limit].
  - Improved the performance of [Deferred.Queue] by changing the
implementation to use lists rather th

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-01-29 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of January 22 to 29, 2013.

1) beta-release of OPAM
2) Portable timeout function
3) omonad-0.0.1
4) OCaml 4.00.1 for Android: OPAM packages
5) Working Group: the future of syntax extensions in OCaml, after camlp4
6) If I wanted to write SWIG in OCaml, what library would I need?
7) Datalog-0.1
8) CWN archive links
9) Other Caml News


1) beta-release of OPAM
Archive: 

** Continuing the thread from last week, Thomas Gazagnaire announced:

I've created a FAQ with these two questions on OPAM wiki: 


Feel free to edit and contribute!

(once we get sufficiently nice contents, this can automatically go somewhere 
on opam.ocamlpro.com as the other wiki pages).
  

2) Portable timeout function
Archive: 

** Samuel Mimram asked and Daniel Bünzli replied:

> I would like to implement a "timeout" function of type:
> 
> float -> ('a -> 'b) -> 'a -> 'b option
> 
> which takes a maximum number n of seconds to run, a function f, an
> argument x, and returns Some (f x) if the computation ends before n
> seconds and None otherwise. Of course, there is a simple
> implementation using Unix.setitimer, but apparently it does not work
> under windows because of signals implementation (and I don't have
> access to a windows machine...). Since this is a pretty standard idom
> I expected to find it implemented in some library, but could not find
> one. Also, I'd rather not heavily change the code (i.e. monadic
> threads are not really an option here, and a small function would be
> appreciated).
> 
> Extra points if your solution also works with js_of_ocaml! :)

This looks very similar to a question I asked a few years ago. You can read 
these threads [1,2]. 

I'm afraid but I think there's little hope that you'll find what you are 
looking for (but I'd love the proven wrong). 

Best,

Daniel

[1] 
[2] 
  
** Gerd Stolpmann replied:

I think this is not possible without changes in the OCaml runtime -
what we would need here is an emulation of signals under Windows, so
that a timer thread could be started that finally sends the signal to
the compute thread. However, such an emulation would be limited to
pure computations, and would not be able to interrupt system calls (no
support from Windows).

As long as you know that your compute functions allocate memory, it
will do garbage collections, and you could set a GC hook:

exception Timeout

let timer tmo f x =
  let t0 = Unix.gettimeofday() in
  let alarm = ref None in
  Gc.major();
  try
let al =
  Gc.create_alarm
(fun () ->
   let t1 = Unix.gettimeofday() in
   if t1 -. t0 > tmo then raise Timeout
) in
alarm := Some al;
let r = f x in
Gc.delete_alarm al;
alarm := None;
Some r
  with Timeout ->
( match !alarm with
| Some al -> Gc.delete_alarm al
| None -> ()
);
None

But this does not work if the function does not allocate enough memory
(and also note that there are several race conditions in "timer").

> Extra points if your solution also works with js_of_ocaml! :)

I don't think that there is any support in js_of_ocaml for completely
asynchronous events (i.e. something like the regular check for signals
the standard runtime does).
  
** Samuel Mimram then added:

Thanks for all your answers! I really appreciated the Gc.create_alarm
hack, which does the job alright for now, but is quite imprecise. I
have submitted a feature request for addition to the standard library
[1], we'll see...

Cheers,

Samuel.

[1] 
  

3) omonad-0.0.1
Archive: 

** Wojciech Meyer announced:

I'm pleased to pre-release a small syntax extension for monadic programming
called omonad.

The major difference between omonad and pa_monad[_custom] is that omonad
does not use Camlp4 and is based on -ppx flag implemented on the current
trunk of the toolchain.

The monadic code can look like this:

  let compute c =
Exception.(perform begin
  a <-- return (1+2);
  b <-- return (a+4);
  return (b + a * c)
end)
  in
  let computation =
Exception.(perform begin
  a <-- compute 10;
  b 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-01-22 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of January 15 to 22, 2013.



1) beta-release of OPAM
2) Stog 0.6 is out
3) Hash function: complexity and circular structures
4) sedlex = ulex without camlp4
5) Fan, a promising replacement of camlp4
6) Job offer on formal methods (fixed term contract)


1) beta-release of OPAM
Archive: 

** Thomas Gazagnaire announced, spawning a huge thread:

I'm very happy to announce the beta release of OPAM (0.9.1). OPAM is a 
package manager for OCaml to install libraries and tools from source 
archives. It supports multiple simultaneous compiler installations, flexible 
package constraints, and a Git-friendly development workflow.

The goal of this beta release is to formally introduce OPAM to the community, 
to gather some general feedback on the documentation and tools and 
double-check that we've not forgotten some useful features. I would also like 
to use that opportunity to make an official call to maintainers: if you have 
developed packages which are already in OPAM do not hesitate to claim their 
ownership and to improve their description - if your packages are not yet in, 
it's time to start packaging them! 

OPAM is developed by OCamlPro[1] and has been in alpha release since June 
2012. It is already quite mature and has gained some nice momentum (+40 
contributors, +300 packages). OPAM has been initially funded by Jane 
Street[2] and the DORM EU research project, and it has received continuous 
help and resources from OCamlLabs[3].

The source code of OPAM is available on Github:
* installer: 
* packages and compiler descriptions: 

* website: 

The documention:
* install instructions and tutorial are available 
* the main source of documentation is 'opam --help' or 'opam  --help'
* user manual: 


You can report issues on github bug tracker:
* 

The next steps for us is to focus on improving the package descriptions 
quality and the global consistency of 
. We will gladly accept any kind 
of help and support from the community to do this! We plan to announce the 
release of 1.0.0 in a couple of months, with improved package quality and 
better integration with the future OCaml platform.

Last point, if you are working in a company and that you already use OPAM, or 
plan to use OPAM, and you would like to help us ensuring it a sustainable 
future[2], you can contact us at 
contact AT ocamlpro.com.


On behalf of the OPAM team,
Thomas Gazagnaire

[1] 
[2] 
[3] 
  
** Anil Madhavapeddy then added:

If you're using Homebrew on the Mac, just do a "brew update" and you should 
get the latest beta release (0.9.1) via it. Enjoy!
  
** Thomas Gazagnaire also added:

To people already using OPAM, I forgot to mention that it is highly 
recommended to NOT upgrade opam using opam. The auto-update thing was a 
mistake at the first place. It is also advised to start from a fresh opam 
init. It should work if you don't, but it would definitely avoid some 
confusions in some corner-cases.
  
** Alan Schmitt asked and Fabrice Le Fessant replied:

> I'm thinking of trying it, but there was a bit of information I could
> not find on the web page: where does OPAM puts the things it compiles?
> Is it easy to just try it with an existing installation of ocaml &
> libraries?

OPAM installs everything in ~/.opam by default, so it won't pollute
your current installation of OCaml. You have to use:

eval `opam config -env`

in a terminal to start using the version of OCaml installed by OPAM
(you can put that in a .bashrc file, for example).
  

2) Stog 0.6 is out
Archive: 

** Maxence Guesdon announced:

It is my pleasure to announce that Stog 0.6 is available from


Stog is a kind of Jekyll in OCaml: It is a static web site generator,
able to handle blog posts as well as regular pages.
  

3) Hash function: complexity and circular structures
Archive: 

** Jean-Baptiste Jeannin asked and Nicholas 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-01-15 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of January 08 to 15, 2013.

1) Batteries 2.0.0 released
2) wrap/unwrap some OCaml code in Emacs
3) some beautiful OCaml code
4) PG'OCaml 1.7
5) FoCaLiZe 0.8.0
6) new meetup: OUPS - Ocaml Users in PariS and OPAM Party
7) ilist-0.1.0 - indexed lists
8) Propagating types to pattern-matching
9) Other Caml News


1) Batteries 2.0.0 released
Archive: 

** Edgar Friendly  announced:

Batteries 2.0.0 is now available for general consumption. After years
of having to put up with the oddity that is "Batteries_uni" and the
issues with Camomile's data files, the Batteries Included Team is
proud to break backwards compatibility and release version 2.0.0 to
fix these.

Now free of any camlp4 and made of 100% pure OCaml with no external
dependencies, batteries is easier to build and better than ever.

A complete list of API incompatible changes and new additions is
available at

and the new documentation is online at


Download from ocamlforge at

  

2) wrap/unwrap some OCaml code in Emacs
Archive: 

** Francois Berenger asked and Gaius Hammond replied:

> Anyone has something to recommend in order to do this in Emacs for OCaml 
> code?
> 
> The use case is you have a big file and you only want to only see the
> code of a few functions and only the first line for other functions.

Code folding, this is usually called. See 

  

3) some beautiful OCaml code
Archive: 

** Francois Berenger said:

The code is here:



There is a full blog post about it there:



Regards,
F.

PS: I'm not the author of this beauty
  
** David Mentre asked and Malcolm Matalka replied:

> Regarding this blog post, the final code is using Polymorphic Variants
> ().
> E.g.
> """
> | _ ->
> Error (`Bad_line s)
> """
>
> I never fully grasped polymorphic variants compared to regular ones
> but I always had the feeling the polymorphic variants where less safe
> that variants because they would allow more possibility to mix
> unrelated things[1].
>
> Are the use of polymorphic variant mandatory to write code
> Return-Value-style code or can regular variants be used?
>
> Best regards,
> david
>
> [1] Of course this ability is the very thing that is of interest to
> people using polymorphic variants.

Hey, author here,

The problem polymorphic variants are solving here is that if you want to
sequence unrelated functions but return their errors, you have to join
their return types with the return types of the function that is calling
them. Polymorphic variants basically do this for you without every
function defining its own error return variant.

This, so far, is the only time I have found polymorphic variants the
best solution for a problem in Ocaml.
  
** Gerd Stolpmann also replied to David:

> I never fully grasped polymorphic variants compared to regular ones
> but I always had the feeling the polymorphic variants where less safe
> that variants because they would allow more possibility to mix
> unrelated things[1].

That's exactly the point: Polyvariants allow you to mix unrelated
things. I don't think, though, that they are unsafer, because you get
help from the compiler to keep these things nevertheless separated.
You need to be aware what can happen, and here and there it is helpful
to add a type hint or a coercion to control typing.

> Are the use of polymorphic variant mandatory to write code
> Return-Value-style code or can regular variants be used?

No. You can also use normal variants, but of course you need then a
declaration like

type error = Bad_line of string | Bad_name of string | ...

before using it. Also, function composition can be very painful.
Imagine you wrote two modules M1 and M2 in this style, and each module
defines an error type. Now you want to call functions from both
modules at one place, and run into the probl

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-01-07 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of January 01 to 08, 2013.

1) new OPAM command-line interface
2) Cmdliner / Uutf / Uunf / Uucd minor releases
3) Building a GADT from an untyped representation
4) ODT 2.3 released
5) Other Caml News


1) new OPAM command-line interface
Archive: 

** Continuing this old thread, Thomas Gazagnaire announced:

Just to let people know that I've taken into account most of the remarks 
(even if I still have few changes to do) so I've merged the cmdliner branch 
into the main tree. Please use the master branch now for testing.
Also, due to an unfortunate sequence of actions (see [1]) all previous 
release of OPAM will likely not compile from source anymore because an url 
change. To fix this, I've release 0.8.3, so packager should upgrade ASAP 
(this is already available in homebrew for OSX users). 0.9.0 should also be 
released quite soon, I'm fixing the few remaining blocker bugs that showed 
off before christmas.

Regards,
Thomas

[1] 
  

2) Cmdliner / Uutf / Uunf / Uucd minor releases
Archive: 

** Daniel Bünzli announced:

The following packages were updated. 

#  v0.9.3
- Allow user specified SYNOPSIS sections.

#  v0.9.2
- utftrip, better tool help. 
- Fix Uutf.is_uchar always returning false. 
Thanks to Edwin Török for reporting and providing the fix and test.

#  v0.9.1
- Updated for Unicode 6.2.0. 
- Fix Uunf.is_scalar_value always returning false. 
- Make the module completely safe for the client. 
- Change command line help of unftrip.

#  v0.9.2
- Updated for Unicode 6.2.0.
- Fix Uucd.is_scalar_value always returning false.
  

3) Building a GADT from an untyped representation
Archive: 

** Philippe Veber asked:

Suppose I define a GADT for expressions:

type _ expr = 
| Int : int -> int expr 
| Float : float -> float expr

Now I want to write a parser, that will build an ['a expr] from a
string. Without thinking much, I tried the following:

let parse_expr : type s. string -> s expr = fun x -> 
  try Int (int_of_string x) 
  with _ -> 
Float (float_of_string x)
;;

Which fails with the following error message:

Error: This _expression_ has type int expr but an _expression_ was
expected of type s expr

That makes sense, since [s] is a locally abstract type. I tried a
couple of variants and finally realised that I could not even write
the type of [parse_expr]: it should be [string -> 'a expr] for some
['a], but I'm not sure that really means something.

So to put it simple, how does one construct a GADT value from a string ?
  
** Later in the thread, Tiphaine Turpin suggested:

I don't think that you can achieve what you are you are asking
exactly, unless ressorting to an existential type. You can do it using
GADT too, as described in the "existential types" section of



For your example, you can write:

type any_expr =
  | Expr : _ expr -> any_expr
;;

let parse_expr x =
  try Expr (Int (int_of_string x))
  with _ ->
Expr (Float (float_of_string x))
;;
  
** Jeff Meister then said and Jeremy Yallop replied:

> However, by using an existential type like that, you're losing the
> additional type checking benefits of GADTs. The return type of parse_expr is
> now any_expr, not 'a expr. You can write e.g. the function extract_int_value
> : int expr -> int, where OCaml knows you don't need to match the Float case,
> but you'll never have an int expr to pass to this function, at least not as
> a result of parsing. Anything handling a parsed any_expr must match the Expr
> case, which of course can have any expr inside. At this point, it seems like
> just a cumbersome way to write the traditional expr type.
>
> I went through basically this same thought process while trying to
> understand how I could apply the new OCaml GADT features, and I concluded
> that GADTs weren't providing any extra utility in the case where they must
> be constructed by parsing an input string. That's a shame since parsing and
> transformation is such a canonical use of OCaml, so I would love to be
> proven wrong here!

The good news is that you can still enjoy the benefits of GADTs, even
when you need to

[cwn] Attn: Development Editor, Latest Caml Weekly News

2013-01-01 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of December 25, 2012 to 
January 01, 2013.

Happy new year!

1) C interop: Return values in parameters
2) Other Caml News


1) C interop: Return values in parameters
Archive: 

** Marek Kubica asked and Török Edwin replied:

> I am trying to wrap a C library in OCaml but I don't know how to do
> this particular thing:
> 
> I have a library that looks roughly like this:
> 
> int function(void** ptr);
> 
> So I get an int as return value to show whether the function succeeded
> and it *sets* the ptr.
> 
> void* ptr;
> function(&ptr);
> // ptr is different now
> 
> How can I wrap such a function in OCaml?
> When I call my OCaml wrapper
> 
> let retval = function ptr in
> ...
> 
> the pointer does not get updated. Is there a function in the C API to
> force OCaml to update the values?

Use a ' ref' for the parameter (or a record with a mutable field) 
on the OCaml side,
and you can update the field on the C side then.

Or if your C type is not actually void*, and your C function doesn't have 
side-effects (besides updating ptr)
you can also make the OCaml function return the actual value, and raise an 
exception if the function failed.
  
** Marek Kubica then said and Gabriel Scherer replied:

>> Use a ' ref' for the parameter (or a record with a mutable
>> field) on the OCaml side, and you can update the field on the C side
>> then.
>
> I was thinking about the same thing and checked
>
> 
> and
> 
>
> and couldn't find how to modify a ref value from C.
>
> My code looks like this:
>
> CAMLprim value ost_read_next_header(value archive, value entry)
> {
> struct archive* handle = (struct archive*)archive;
> struct archive_entry* ent = (struct archive_entry*)entry;
> printf("ent: %p\n", ent);
> int retval = archive_read_next_header(handle, &ent);
> // ent changed
> printf("ent: %p\n", ent);
> entry = (value)ent;
> return Val_int(retval);
> }
>
> And the second parameter is defined as "entry ref", yet when I look at
> the resulting value from OCaml, the ref's value did not change:
>
> let entry = ref (Archive.entry_new ()) in
> Archive.print_pointer !entry;
> ...
> ignore (Archive.read_next_header handle entry);
> Archive.print_pointer !entry;
>
> It still points to the same value that my Archive.entry_new returned.
>
>> Or if your C type is not actually void*, and your C function doesn't
>> have side-effects (besides updating ptr) you can also make the OCaml
>> function return the actual value, and raise an exception if the
>> function failed.
>
> I thought about this, but I have a number of these functions and some
> have more than one return parameter, so I'd need to return a tuple at
> least. I plan to make this wrapper as close to C and low-level, so I
> can write a proper high-level wrapper on top.
>
> If the ref-appoach does not get me anywhere, I might still do this.

References are a derived concept defined as:

type 'a ref = { mutable contents : 'a }

You can update them from the C side just as you would handle a
polymorphic record, with Field and Store_field.

In the code you show, the OCaml value corresponding to the pointer is
exactly the pointer, hidden as a 'value' type. This is correct as
OCaml detects out-of-(OCaml)-heap pointer. However, if you used a
custom block instead (

), OCaml would do the boxing for you: Data_custom_val(v) already
returns a pointer than can be dereferenced or mutated.

I think you have a choice between using references explicitly for
those functions of the API that mutate input references, or uniformly
representing this type of data as a custom block. The latter option
may be valuable if you have uses for the other features of custom
blocks, eg. the user-defined comparison and finalization operations,
and probably not worth the trouble otherwise. Finally, explicitly
using references to signal mutability in some part of your API is
probably clearer and a better design.
  

2) 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 .

Singleton types for code inference, continued:
  


Singleton types for code inference:
  


Macaque 0.6.1:
  

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-12-25 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of December 18 to 25, 2012.

Merry Christmas!

1) new ocaml.org website
2) OCaml wiki
3) OCaml search into libraries for ocaml.org
4) Post-doc/Software Engineer at OCamlPro
5) Other Caml News


1) new ocaml.org website
Archive: 

** Ashish Agarwal announced:

We are pleased to announce that a new website for the OCaml community
is now live at . Please get in the habit of referring
to this site instead of caml.inria.fr as our goal is to port all
content to the new site (most has already been done but a few pages
remain).

You can contribute by forking the github repo:
[1] 
  

2) OCaml wiki
Archive: 

** Wojciech Meyer asked, spawning a huge thread:

These days ocaml.org is a great resource and starting point for the
community and people interested in learning OCaml. It would be great
however if we have a collective wiki for OCaml too. Not being here at
any rate competitive and just complementary.

It could cover:
- using core toolchain
- tooling like Oasis, OPAM, ocamlfind, ocamlbuild etc.
- type system tricks
- small projects with good code examples
- tools settings, emacs & vim configuration snippets
etc.

it should be searchable, and fairly centralised.

What kind of wiki engine we would like to use?

I'd just opt either for oddmuse, mediawiki perhaps with some movement
towards custom one based on Ocsigen and Eliom, but here I don't have any
strong opinions, feel free to propose anything else.

Separate issue is storage and server etc., I'd happily organise/discuss
these things, once we know the details :-)

I'm open for any ideas and people joining up with the effort.
  
** Benedikt Meurer suggested and Anil Madhavapeddy replied:

> Why not use the wiki provided by Github for the ocaml.org project?

That works too; Thomas has written a Github Markdown to HTML converter in
COW [1], and is using that to generate the OPAM website from the Github
wiki (for the documentation that you see on ).

[1] 
  
** Vincent Balat suggested:

We have been using our home-made (Eliom based) wiki for years on
 and  and it is
probably a good candidate for ocaml.org. The project is called
Ocsimore (see  ).
 
You can test it on page:

 
Log in with user "test", password "test".
 
and see the manual for the syntax here:

 
This wiki is somewhat different from all others, but has very
interesting features that may be useful for ocaml.org:
 
* you can mix static pages and wiki pages: if the static page is
present, it will be sent, otherwise the wiki page is displayed. It is
possible for example to keep the current web site and add
progressively new pages using the wiki.
 
* you can create several wikis on the website, corresponding to
different rights. For example  is a wiki
restricted to ocsigen's developers.
 
* There is no default page container, and no default stylesheet: each
wiki has its own container, common to every page of the wiki, that is
itself written using wiki syntax. Editing the container requires
special rights.
 
* CSS are also edited online (by the users who have the right for
this)
 
* You can create CSS for the whole wiki or specific CSS for some pages
 
* The base component of the wiki is not the page, but the "wikibox"
Each page (and each wikibox) can contain several wikiboxes, and a
wikibox may appear on several pages
 
* Each wikibox can be given specific rights (read/write/see
history/change CSS...)
 
* Each wikibox may itself be a container. For example if you want a
menu common to several pages.
 
* The wiki syntax is following the wikicreole standard, with some
additions. The goal is to have most the possibilities offered by HTML.
All the pages from the websites mentioned above are written with this
syntax.
 
* It is possible to write extensions to the wiki syntax. For exemple we have
<> to display OCaml with syntax highlighting.
 
 
Ocsimore also has a forum module (for messages/comments) but it is
still beta.
 
Ocsimore is conceived to be extensible and very customisable (even if
it requires to understand a complex piece of code). It has very
powerful right managements.
 
We never announced/released Ocsimore yet because there are still a lot
of work to do to improve user friendliness. But things improved a lot

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-12-18 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of December 11 to 18, 2012.

1) new OPAM command-line interface
2) RTT (Run-time types) online toplevel for trying
3) Other Caml News


1) new OPAM command-line interface
Archive: 

** Thomas Gazagnaire announced:

In order to prepare the beta release of OPAM (which should hopefully be 
announced at the end of next week if everything goes well), I've been working 
on improving its command-line interface (which is currently a bit had-hoc). 
Thanks to the great Daniel Bunzli's cmdliner[1] library, I now have a nice -- 
but incompatible -- command-line interface in the 'cmdliner' branch[2].

The main changes are:
* an uniform help interface, where all flags and parameters are correctly 
documents
* no more -long-option, only -s or --long
* 'opam remote' is still there for convenience but will be deprecated; use 
'opam repository' instead
* use of sub-sub-commands when necessary (ie. 'opam repository add')
* use non-ambiguous prefix of sub-command instead of the subcommand (ie. 
'opam repo' or 'opam rem')
* AND: a nice 'opam --help' and 'opam  --help' output

I'm quite keen to get community feedback on this new command-line. Feel free 
to comment here, or to to use the issue tracker[3].

Cheers,
Thomas

[1] 
[2] git clone -b cmdliner git://github.com/OCamlPro/opam.git
[3] 
  

2) RTT (Run-time types) online toplevel for trying
Archive: 

** Tiphaine Turpin announced:

Sorry for spamming again on RTT (Run-time types for OCaml). This is just
to announce an online trying version (obtained by patching the Try OCaml
website). The current distribution (0.4) also improves the initial
release significantly.

Try RTT:



Documentation:


  

3) 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 .

RTT 0.4:
  

Eliom 3.0:
  

Canswer:
  
  

Old cwn


If you happen to miss a CWN, you can send me a message
([email protected]) 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 at
 .



___
caml-news-weekly mailing list
[email protected]
http://lists.idyll.org/listinfo/caml-news-weekly


[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-12-11 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of December 04 to 11, 2012.

1) otags reloaded 4.00.1 for OCaml 4.00
2) ocaml.org infrastructure list available
3) Js_of_ocaml 1.3
4) GODI imports OASIS
5) Documenting the compiler
6) Ocsigen: Eliom 3
7) Creating fresh OPAM repository
8) Other Caml News


1) otags reloaded 4.00.1 for OCaml 4.00
Archive: 

** Hendrik Tews announced:

I would like to announce the first release of otags reloaded for
OCaml 4.00. It is available at



Otags reloaded generates tags tables for emacs and vi/vim. This
version supports GADT's and does not compile with OCaml 3.12.

Otags reloaded is distributed under GPL v3.
  

2) ocaml.org infrastructure list available
Archive: 

** Anil Madhavapeddy announced:

The ocaml.org machine infrastructure has been settling into place, and 
 is now available.

This runs GNU Mailman, and has a single "infrastructure" list at the moment. 
This list is where we can discuss setting up the other services such as the 
continuous build regression testing and website, and integrating other 
services such as .

If you are interested in helping out or simply following activities, please 
join:


The server will be hosting more lists in the near future, which I will 
announce here. If you have a list you'd like to move to this server for your 
project, please get in touch. We can create private lists also if needed, 
although publicly archived ones are preferred.

The look and feel of the lists installation is quite barebones at the moment. 
We'll improve the integration with www.ocaml.org once the rest is up and 
running smoothly.
  

3) Js_of_ocaml 1.3
Archive: 

** Jérôme Vouillon announced:

I'm happy to announce release 1.3 of Js_of_ocaml, a compiler from
OCaml bytecode to Javascript. This release is compatible with OCaml
4.x. It adds WebSocket bindings and fixes a number of bugs.

LINKS

Project home page 
Download 
Get source code darcs get 
Documentation 

DETAILED CHANGES

* Features/Changes
** Runtime and toplevel updates to support OCaml 4.0
** Add WebSocket bindings
** Added -debuginfo option to output source code location information
(patch by Kensuke Matsuzaki)
** Dom_html: added change, input and hashChange event bindings

* Bugfixes
** Fix array and string blitting with overlapping regions
** Url module: fix encoding of '+'
** Library: use 'this' instead of 'window' for better portability
** Dom_html: fix creation of elements with type or name attribute
under IE 9
** Compiler: small fix to bytecode parsing that could result in
incorrect generated code
** Dom_html: fix mouse wheel event bindings
** Dom: fix the type of item methods
** Deriving_json: tail-recursive serialisation of lists (by Hugo Heuzard)
** Deriving_json: fix parsing of float arrays and polymorphic variants
(by Hugo Heuzard)
  

4) GODI imports OASIS
Archive: 

** Gerd Stolpmann announced:

the GODI project has now set up an experimental OASIS-DB import. This
means that packages submitted to OASIS-DB appear as normal GODI
packages in godi_console, and can be managed in the normal way.

We are now importing nightly into a separate repository that needs to
be activated. Find the instructions (and a number of FAQ) here:



Remember that OASIS packages are not QA-checked, and as a result many
packages still fail to build. This often has trivial reasons (like
that the build is ok, but the documentation fails). I hope to hear
your comments on this.

Also, any comment on user experience is very welcome.
  
** Sylvain Le Gall replied and Gerd Stolpmann said:

> Some answer:
> - the OASIS package ignores the --destdir:
> 
> There is an open bug for that 
> 
> 
> Please read and comment. I just decided to let ocamlfind decide the
> destdir

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-12-04 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of November 27 to December 
04, 2012.

1) phantom types and identity function
2) Github OCaml mirror available
3) creating a module from a #use directive in the toplevel
4) Other Caml News


1) phantom types and identity function
Archive: 

** Ivan Gotovchits asked and Jacques Garrigue replied:

> These simple signature 
> 
> module type T = sig
> type 'a t constraint 'a = [< `A | `B ]
> val init: [`A] t
> val f: [`A] t -> [`B] t
> end
> 
> can be used to constrain the following module
> 
> module T : T = struct
> type 'a t = unit constraint 'a = [< `A | `B]
> let init = ()
> let f x = x
> end
> 
> where identity function successfully satisfies the constraint
> 
> [`A] t -> [`B] t
> 
> but in the following module 
> 
> module T : T = struct
> type 'a t = {x:int} constraint 'a = [< `A | `B]
> let init = {x=0}
> let f x = x
> end
> 
> the same identity function doesn't satisfy.

In the first case, a type abbreviation is used.
Since ('a t) expands to (unit), the parameter is completely
ignored, so that you can replace it by anything.

In the second case, you define a concrete type,
so that the parameter is not forgotten.
Note that you cannot even use subtyping for that:
let f x = (x : [`A] t :> [`B] t)
fails too.
But there is an easy workaround, defining in two steps:
type u = {x:int}
type 'a t = u constraint 'a = [< `A | `B]
  
** Gabriel Scherer then added:

I have been a bit confused by this discussion, and found the relevant
part of the manual that may enlighten other list readers:

The OCaml Language, Type and exception definitions


"If the type has either a representation or an equation, and the
parameter is free (i.e. not bound via a type constraint to
a constructed type), its variance constraint is checked but
subtyping etc. will use the inferred variance of the parameter,
which may be better; otherwise (i.e. for abstract types or
non-free parameters), the variance must be given explicitly, and the
parameter is invariant if no variance was given."


Note that this would not be needed if we had an explicit way to
express the variance of invariant (the variable appears in both
positive and negative positions) and irrelevant (the variable doesn't
appear except in irrelevant positions) explicitly. We could then
write, say:

type 0'a t = {x : int} constraint 'a = [< `A | `B ]

The absence of such a variance marker means that some OCaml code is
hard to abstract through a module boundary: in presence of the
explicit definition, the type-checker will accept to subtype between
any instances of the type (by simple expansion), but if you abstract
over its definition you cannot express this property anymore. Your
workaround corresponds to statically expressing this irrelevance
through an exported equation, but there are (arguably somewhat
unnatural) scenarios where this isn't convenient.
  
** Ivan Gotovchits then asked and Gabriel Scherer replied:

> And now I'm confused much more =). Please, could you explain the
> relevance between subtyping and type restriction?
> 
> When I try to restrict type [t -> t'] by the some type [r -> r'] does
> the compiler checks that [r -> r'] is a subtype of [t -> t']? And even
> if it does, in my example 
> [`A] t -> [`B] t
> 
> [[`A]] is clearly not a subtype of [[`B]] (and vice versa). So I do not
> see how an explicit variance specification can help.

I was reacting mostly to Jacques' remark that "you cannot even use
subtyping for that".

The relation between subtyping and "constraint" is as explained in the
manual excerpt I quoted. The following is valid:
type 'a t = {x : 'a} ;;
let f x = (x : [ `A ] t :> [ `A | `B ] t);;

but the following is not:
type 'a t = {x : 'a} constraint 'a = [< `A | `B ];;
let f x = (x : [ `A ] t :> [ `A | `B ] t);;
Error: Type [ `A ] t is not a subtype of [ `A | `B ] t
The first variant type does not allow tag(s) `B

The reason for this behavior is that in the first case, t was inferred
covariant, while the presence of a constraint disables variance
inference (in the manual: "otherwise (ie. [...] for non-free
parameters) the variance must be given explicitly)"). You can make the
constrained version work with an explicit variance annotation:
type +'a t = {x : 'a} constraint 'a = [< `A | `B ];;
let f x = (x : [ `A ] t :> [ `A | `B ] t);;

Finally, while in this example 'a occurs positively in ('a t), in your
example 'a did not occur at all. In this case it is correct to coerce
from (foo t) to (bar t), whatever the type expression (foo) and (bar)
are -- they don't need to be in a subtyping relation. The following
works:
type 'a t = { x : int };;
let f x = (x : [ `A ] t :> [ `B ] t);;

I'm calling this form of varia

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-11-27 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of November 20 to 27, 2012.



1) Poll results of OASIS, package manager and misc.
2) open faculty position in Big Data at Wright State University
3) how to wrap a command line call correctly?
4) Monad Library?
5) RPM's for OCaml 4.00.1 and associated libs for Mageia 2
6) opass - encrypted password db
7) Multithreaded https requests in ocamlnet netclient
8) New group: Pragmatic functional programming research
9) Other Caml News


1) Poll results of OASIS, package manager and misc.
Archive: 

** Continuing the thread from last week, Sylvain Le Gall said:

After searching a bit here is the right link:


This one doesn't require authorization, please use it.
  

2) open faculty position in Big Data at Wright State University
Archive: 

** Pascal Hitzler announced:

We are seeking a faculty member in Big Data. Appointment at any rank
is possible (Assistant, Associate, or full Professor).

Particular areas of interest include, but are not limited to, data
management and lifecycle, data analytics, data visualization, data
fusion and integration, semantics and ontologies, social and sensor
Web, biomedical and health informatics.

Outstanding applicants with a high potential for collaborations with
existing strengths of the department and the Kno.e.sis Center are
particularly welcome to apply. Outstanding applicants specializing in
other emerging research areas are also welcome to apply.

For more information:


- or email me.
  

3) how to wrap a command line call correctly?
Archive: 

** Florent Monnier asked and Malcolm Matalka replied:

> I would like to know how to wrap a command line call correctly?
>
> I particular keep the same order of the output messages for stderr and
> stdout correctly, how to handle the cases when there is something on
> stdin or not, etc.

You can use Jane St Async or Lwt, but your application needs to work
within that context for the best results (although I'm sure you can
do something clever here). Otherwise you probably need to use the Unix
model or similar and write your own little select loop. Or use threads
perhaps.
  
** Gerd Stolpmann also replied:

There is no way to keep the order of output messages, except you
assign stdout and stderr to the same descriptor.

Otherwise, the Shell library included in Ocamlnet is your friend:



Especially, it can also be used in a synchronous environment (no need
to tie yourself to Lwt), but async usage is also possible.

Shell takes advantage of the fast posix_spawn calls so far provided by
the OS (e.g. on Linux and OS X), which means a significant speed
advantage compare to fork+exec.
  

4) Monad Library?
Archive: 

** Chris Yocum asked:

I was looking into using Monads in my programs but I am slightly at a
loss as to what library is in general use. There is pa_monad but that
seems to be a ocamlp4 exention and not a library. There is
 but that doesn't seem to be
in opam or in godi so I am unsure as to its status.

Does anyone have any suggestion for a well supported monad library for
Ocaml?
  
** Wojciech Meyer replied:

pa_monad is really useful and nice, I think the updated library is
available as pa_monad_custom OPAM package.

> Does anyone have any suggestion for a well supported monad library for
> Ocaml?

First I would need to find an answer what do you mean by a monad library.

Monads is a general abstraction with a very simple interface. so they
don't require library as such.

However I agree it would be good to have some library that provides a
monadic interface to some common functionality found maybe in std
libraries, also some way of composing monads would be good having
monad transformers along. Batteries included offer monadic interface
to some common data types like list, bool, option.

You could look at Xavier Leroy's lectur

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-11-20 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of November 13 to 20, 2012.

1) Camlimages with ocamlbuild
2) OCaml messages in French
3) About ocamlbuild
4) GADT exhaustiveness check
5) DWARF output for native-code
6) Poll results of OASIS, package manager and misc.


1) Camlimages with ocamlbuild
Archive: 

** Pierre-Etienne Meunier announced:

As an answer to Samuel's mail of november the 7th (and coincidently, also to
the one he sent today), I have just written a patch to camlimages solving, at
least for me, the problems I got when trying to compile camlimages under mac
os.

Since I don't know how to contact camlimages' authors, and that all the
patchs I ever sent to macports have always be more or less silently refused,
I temporarily pushed my solution there:

darcs get 

This version uses ocamlbuild instead of omake as its build system, and ocaml
instead of m4/autotools/bash as its configure script. I would be interesting
to know if this version is useful under linux to bypass omake's bugs for the
versions before the next one.
  

2) OCaml messages in French
Archive: 

** Alexis Irlande announced:

Here is a link to an alpha version of my patch that translates ocaml messages
to French.



This is the first "public" release so I would greatly appreciate comments
especially about installation instructions, grammar, spelling, typography,
oversights and "official" french OCaml jargon.

I hope to be able to release the same for Spanish soon.
  

3) About ocamlbuild
Archive: 

** Deep in this thread, Pierre-Etienne Meunier said:

My original idea was not at all to start a new ocaml-tools war, I'm sorry if
my first message was poorly formulated. Let me make myself clear, I wrote a
typesetting system in ocaml, in order to write my PhD thesis. The way it
works is a little strange, it compiles your source to ocaml source code (our
language is quite cool, because based on a dypgen grammar, but you can use
another one if you have time to write a parser and code generator). Then it
compiles this code with a library called "Typography", that does all the
document processing stuff, optimization of the page breaks, and so on.
Finally, it calls another library to output to different formats, such as
pdf, plain text, svg, opengl, or anything else.

These are clearly "separable but not independent" projects (drivers, document
formats, font library, typesetting library, parser/code generator). So
compiling everything without duplication is not that trivial, and I really
would like to write an ocaml program to compile it, maybe using a more
complex build system than just one file with the ocamlbuild api. I understand
that ocamlbuild is still in an early stage of development, this is why I'm
sending these mails. The code is split among different directories, and using
a library interface in the compilation of another library still seems
difficult in ocamlbuild today. The documentation explains how to use an
internal library in program, but it forces you to use a particular layout of
your files. This is why I feel that a library would be more versatile: we can
imagine a makefile compiling the build system first, possibly split between
several modules, then calling it to compile the rest, like xmonad does, for
instance.

Also, if you are writing a document with our system, separated between
different files, you want the system to compile it automatically, without too
much recompilation. The problem is extensibility: for instance, if you are
writing a bibliography library (I wrote one, but there may be others in the
future), you certainly do not want to touch our code in order to compile it.
Instead, you want to write a dynlinkable module explaining to our system how
the documents depend on bibliography files, and how to compile everything in
what order.
To do this, I had to rewrite a (small) ocamlbuild-like library. My point is
that ocamlbuild exposes (or documents) a too small part of its internals to
be re-used inside another project.
  
** Fabrice Le Fessant then replied:

Actually, this use case is exactly the reason why I developed the
"ocp-build" tool (you might have used it if you tried to compile
opam). It's much less powerful than ocamlbuild, but for what it does,
i

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-11-13 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of November 06 to 13, 2012.

1) Google+ page
2) OASIS, package managers and misc. poll
3) parameterized classes, modules & polymorphic variants
4) RTT: Run-time types for OCaml
5) Cyclic data structures: internal representation
6) Other Caml News


1) Google+ page
Archive: 

** Deep in this thread, Paolo Donadeo announced:

For what it's worth, Christophe's logo has been stolen (by me) and has
become the icon of the (official?) Google+ page of the language :-)




  

2) OASIS, package managers and misc. poll
Archive: 

** gildor478 announced:

If you have trouble viewing or submitting this form, you can fill it out online:


One day, OASIS-DB will be able to automatically create package and
repositories. We need to know what OASIS user wish to focus our effort
on a few package manager.

Preferred package manager Choose the package manager oasis-db should
support

GODI
odb.ml
OPAM
native Debian packages
native RPM packages (Fedora, Centos)
non, OASIS should provide a package manager itself

Preferred build system OASIS support by design ocamlbuild, but there
are some other build system around. Which one do you think are worth
to be supported by OASIS.

ocamlbuild
OCamlMakefile
OMake
ocp-build
custom scripts
native Makefile
  

3) parameterized classes, modules & polymorphic variants
Archive: 

** Didier Cassirame asked and Jacques Garrigue replied:

> I have been trying recently to combine classes, modules and variants
> in the following fashion:
>
> module A1 = struct
>
> class ['a] t = object
> constraint 'a = [>`a]
> method m : 'a -> string = function `a -> "a" | `a1 -> "a1" | _ -> "_"
> end
>
> end;;
>
> [?]
>
> module type A = sig
>
> class ['a] t : object
> constraint 'a = [>`a]
> method m : 'a -> string
> end
>
> end;;
>
> type m = (module A);;
>
> let l: m list = [ (module A1); (module A2); (module A3)];;
>
> 
>
> Unfortunately the list typecheck fails. However, making a list of
> class instances from A1.t, A2.t, A3.t succeed, with the type:
>
> [> `a | `a1 | `a2 | `a3 ] ct list
>
> ct being defined as equal to A.t.
>
> I thought that perhaps I should parameterize the type m from the type
> parameter 'a of A.t to solve my problem, but I am not sure of the
> syntax, or if it's the problem. Does anyone have an idea?

Actually the parameterization would not help here, since you want to put them
all in the same list.
The idea of using first-class modules is to be explicit about types, so using
an explicit type definition for a solves the problem.

Jacques Garrigue

module A1 = struct
type a = private [> `a | `a1]

class t = object
method m : a -> string = function `a -> "a" | `a1 -> "a1" | _ -> "_"
end
end;;

module A2 = struct
type a = private [> `a | `a2]

class t = object
method m : a -> string = function `a -> "a" | `a2 -> "a2" | _ -> "_"
end
end;;

module A3 = struct
type a = private [> `a | `a3]

class t = object
method m : a -> string = function `a -> "a" | `a3 -> "a3" | _ -> "_"
end
end;;

module type A = sig
type a = private [> `a]
class t : object
method m : a -> string
end
end;;

type m = (module A);;

let l: m list = [ (module A1); (module A2); (module A3)];;
  

4) RTT: Run-time types for OCaml
Archive: 

** Tiphaine Turpin announced:

I would like to announce the first release of RTT: an implementation of
run-time types for OCaml.



Run-time types make it possible to write generic printers such as
to_string: 'a -> string (for all 'a) which is useful e.g., for
debugging. The present solution is implemented as a fully automatic
program transformation which supports polymorphism naturally, and is
rather orthogonal to other existing work regarding advanced "typed"
representation of types using GADTs (the representation used here is
untyped).

Using RTT amounts to calling Rtt.to_string, Rtt.pprint... with a
modification of the compilatio

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-11-06 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of October 30 to November 06, 
2012.

1) Why should I use .mli files?
2) Functional programming users group in Cambridge, UK (free beer!)
3) Writing the function Set.map using first-class modules and 4.00 inference
4) Bisect 1.3 release
5) OCaml interpreter in JavaScript
6) Other Caml News


1) Why should I use .mli files?
Archive: 

** Deep in this thread, Jacques Garrigue explained:

Wow.
I see that a big debate is going on mli files and declarations
inside ml files.

I think that lots of people have given this problem a lot of thought
during many years.
My conclusion has unfortunately been that trying to solve this at
the language level without breaking backward compatibility is
very difficult.

For instance, one is currently allowed to do something like that:

a.ml:
let f x = x

let b = f true

a.mli:
val f: int -> int

This may look stupid, but this kind of code (of course more
complicated) exists in the wild, and sometimes for sensible
reasons.
For this kind of reason, I do not see any easy way to import
information from mli files to ml files.

Now, is maintaining mli files really painful?
In my experience, not at all.
Taking as example the ocaml compiler itself, the only
duplication that bothers me a little is the error type exported
by many modules, as one always has to keep it in sync by
copy-paste. This is a bit of a problem because for most uses
this type could be abstract (you don't really care about its
contents), but in some rare occasions you need it public.
For other types, do not see syncing as a disadvantage, because
it rather makes you conscious that other modules depend on
this type, so better look at it twice :-)

Of course I know that some people (probably with a different
background) do not like mli files.
Couldn't we just imagine a preprocessing tool that allows to
generate both ml and mli from the same file?
This is pretty standard for literate programming.
It could even call the compiler if you want the types to be inferred
automatically (even though I personally think that having to write
value types in the mli file is good, because you know when you
are changing an export.)
As an external tool, it could use pragmas (keywords inside
comments) for instance.
Something close to ocamldoc (ocamldoc itself?) but which you
would integrate in the compilation cycle.

Anyway, I just wanted to state, from my experience, my lack of
enthusiasm about modifying the core language to accommodate
that.
  

2) Functional programming users group in Cambridge, UK (free beer!)
Archive: 

** Mike McClurg announced:

We're starting a functional programming group in Cambridge, UK, called
NonDysFunctional. We're having our first meet up this Friday from 5pm
to 9pm at the Old Spring Pub. Feel free to come at any time during
that window. Citrix has kindly offered to pay for everyone's beer, so
come thirsty!

See our website for more information, including a map to the Old
Spring: 

Also, we will be tweeting about future events on @nondysfun
()

If you think you might come, please email me, just so I have an idea
of how many people might turn up. You don't have to register in order
to come, however. Hope to see you there!
  
** He later added:

We had a successful meeting last Friday for our first Cambridge
functional programmers meetup. As requested by those who turned up,
I've created a meetup group to help us organize. If you are
interested, please join here:



We're probably going to have another meeting in early December. It
will probably just be another pub meetup. If you've got any requests
for dates or for particular pubs, please let me know.

Now that we've got an online home at meetup.com, I'll avoid spamming
this list with future announcements.
  

3) Writing the function Set.map using first-class modules and 4.00 inference
Archive: 

** Jeff Meister said:

I found an interesting (to me, anyway) use of OCaml's first-class
modules, and particularly the new 4.00 type inference features, which
I thought was worth sharing with the list. This has probably been
observed by someone else already, but I haven't seen it discussed.

In the OCaml standard library, the polymorphic set da

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-10-30 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of October 23 to 30, 2012.

1) OCaml-bitcoin 1.0
2) Bolt 1.4 release
3) opam and versions
4) Other Caml News


1) OCaml-bitcoin 1.0
Archive: 

** Dario Teixeira announced:

OCaml-bitcoin is a library offering an OCaml interface to the official
Bitcoin client API. It works by making JSON-RPC calls over the network
to a running Bitcoin daemon offering the client API. The project's
homepage can be found here:



Bitcoin has been a controversial subject, to say the least. With this
in mind, I've written a blog post that hopefully clarifies my view on
the subject. It also contains some technical information concerning
the implementation of OCaml-bitcoin:



To summarise: the release of this library should not be construed as
an unconditional support of Bitcoin in its current form. There is
enough potential in the idea, however, to warrant some guarded
support.
  

2) Bolt 1.4 release
Archive: 

** Xavier Clerc announced:

This post announces the 1.4 release of the Bolt project, whose goal is
to provide a comprehensive yet flexible logging framework for the
OCaml language.

Home page: 

Main changes since 1.3:
- API change: introduction of modes, allowing to choose when data is written
- API change: updated support for Pajé format (version 1.2.3)
- support for '&&' and '||' in filters (new configuration format only)
- new 'minimal' layout using only message
- new 'bell' output writing the bell character on the standard output
- new 'say' output using MacOS X text-to-speech
- support for Growl under Windows
- bug#86: '-ocaml-prefix' doesn't really work
- bug#87: install shouldn't build anything
- bug#89: do not activate warnings by default
- bug#105: crashes with 'Not_found' when both BOLT_FILE and BOLT_CONFIG are not 
set
- bug#107: when using syntax extension with level NONE, preprocessed code
  

3) opam and versions
Archive: 

** Jon Ludlam asked and Thomas Gazagnaire replied:

> For our purposes, we need to be able to ensure that our builds are
> reproducible, and hence need to know exactly which versions are installed.
> We had hoped to achieve this by removing or disabling packages whose
> sources were got directly from a master branch in github. However, it turns
> out that some packages that are 'stable' are dependent upon these packages,
> which seems brittle. The question is how to fix it? Should the opam
> repository maintainers require that 'stable' packages aren't dependent on
> 'unstable' ones? Should opam itself be aware of the difference and enforce
> this policy? If someone really wants to release a stable version of their
> thing and it's dependent upon an upstream project with only a github repo,
> should the developer engage the upstream devs and request at least a tag,
> or should they make their own tarball/github fork?

Before the 1.0 release my plan is:
* to remove the unstable packages in the main opam-repository (ie. every
packages should have a stable tarball with a fixed checksum) [1]
* add a way to specify commits/branches for unstable packages if needed. [2]

The current workaround is, as Anil pointed out, to clone opam-repository, use
'opam-mk-repo' at its root to generate a local mirror of opam.ocamlpro.com,
and tell opam to add the local repository as a remote: 'opam remote -add
local /path/to/your/local/repository'

Then 'opam remote -list' should display the list of repositories and their
respective priority (higher is better). You can also tweak ~/.opam/repo/index
manually to tell opam to use your local repository only for some packages,
for instance the unstable ones (don't forget to run 'opam update' after
changing the index file).

For [1], I'm gladly accepting external contributions (for [2] as well
actually if someone really wants to hack into opam).

--
Thomas

[1] 
[2]  
  

4) 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 post

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-10-23 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of October 16 to 23, 2012.

1) Silicon Valley
2) llpp v13
3) OCaml Labs
4) GODI news
5) opam and versions
6) Ocuality v0.8
7) Parameterizing a function with a thread monad
8) Other Caml News


1) Silicon Valley
Archive: 

** Mike Lin asked and William Le Ferrand replied:

> I'm curious what kind of critical mass there might be for an OCaml
> meetup/UG in Silicon Valley. Who's around? Has this been tried/failed
> before?

There used to be "OCaml dinners" in bay area, 3 or 4 were organized
about 1 year ago. At some point we even held a little hackathon
resulting in a small website for posting ocaml challenges (code should
be at ), now deceased.
  
** Ashish Agarwal then added:

Mike, I suggest you just start a group on . We've
had good success with the NYC OCaml Meetup (and it's not just because
of Jane Street, indeed most of our members are not from Jane Street).
The hard work is in recruiting speakers to give talks, organize
hack-a-thons, etc., but it only takes a couple committed people to
make it work.

And once you start it, be sure to let the  dev team
know so we can add it to the new website under the Meetings section.
  

2) llpp v13
Archive: 

** malc announced:

New version of llpp (tagged v13) is now available at


Blurb:

llpp a graphical PDF viewer which aims to superficially resemble
less(1)

Changes:
* Bugfixes
* Presentation mode in multi column case
  

3) OCaml Labs
Archive: 

** Yaron Minsky announced:

A thing that should be of interest to many on this list. We discussed
this already at the OCaml Users and Developers conference, but we're
now talking about it more widely: a new lab is being formed at
Cambridge University that is focused on improving the OCaml ecosystem.
Jane Street is the primary funder, and Anil Madhavapeddy is the
technical lead.

If you're interested in reading a bit more about it, both Anil and I
have posts about it:

- 
- 

We hope and expect this effort to add to the energy and excitement of
the OCaml community, and to contribute materially to the software
infrastructure we all depend on.
  
** Paolo Donadeo asked and Anil Madhavapeddy replied:

> While I'm very grateful for your effort and while anxiously waiting for
> your book, I notice that in your post you mention a brand new package
> manager, OPAM.
>
> Do we really need of yet another package manager? How can't OPAM scatter
> the community further?
>
> Now, if I write a small library and I want to make it available to OCaml
> developers, I have to care about: making the source code Debian and Red Hat
> friendly, godi friendly, oasis-db friendly and, now, OPAM. And there are
> probably other systems I don't even know.
>

This is certainly a valid criticism given the current state of affairs,
but I would encourage you to listen to Thomas' talk to OUD to get an
overview of why OPAM came about, and where it's going:


OPAM has picked up lessons from all the other previous package managers,
and is, as Markus noted, a generally pleasant experience for beginners to
use. It supports a nice workflow for developing libraries, has
first-class support for multiple repositories (either DVCS or local
archives), and simultaneous installations of multiple standard libraries.

Just this by itself probably wouldnt justify a brand new package manager,
and the longer term plan is tighter integration with OASIS, ocamlbuild and
the many other build systems available. Ultimately, we want to make it
really easy for a beginner to jump in, write their own code, reuse other
peoples code, and publish it online. There have been a number of (very
brave and good) pieces of this puzzle over the years (notably OASIS), but
OPAM aims to pull them all together into an integrated whole.

You'll see much more of this in the next few months as OCaml Labs spins up
and begins supporting OCamlPro more in their efforts. The first thing
we're doing is to get the ocaml.org infrastructure in place (and moving
over the excellent ocaml-lang.org over to the new domain), and part of
that work will be to figure out the unification o

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-10-16 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of October 09 to 16, 2012.

1) Improved syntaxic coloration
2) Godi for Windows
3) Parmap package in OPAM
4) Fan hosted on github now
5) Other Caml News


1) Improved syntaxic coloration
Archive: 

** Lilian Jean BESSON announced:

I'm publishing today some files to improve syntaxic coloration for
OCaml sources (.ml .mli) using the GTK SourceView library.

Gedit and Gobby are popular text editor which use GTK SourceView for
syntaxic coloration, and my two files (ocaml.lang and naereen.xml are
in the archive sent with this email) can be used with them to give you
one of the best OCaml sources syntaxic coloration ever !

If you are not yet conviced, take a look at my page
 (those
file are also attached to the message), which aims to show some of
improvement done by my modifications. Detail concerning installation
and personalisation of the color profile naereen.xml are given there
(sorry for non-french users, this page is not yet translated in
english). Some improvement are steel experimental, like OCamlDoc
format balises in ocamldoc comments.

Moreover, the language file ocaml.lang can give ideas to improve the
other popular syntaxic coloration solutions : VIM, Emacs, PyGmentize,
nano, caml2html, or also Jota Text Editor for examples.

If those two files appears to be useful for one of you, I'll send
theme to GTK SourceView developpers, hopping they will be include in
the next versions of GTK SourceView 2 and 3.
  

2) Godi for Windows
Archive: 

** Andreas announced:

This post announces the creation of a godi distribution for windows.

"Wodi" differs from the official godi distribution in the following
ways:

- it ships binary packages for windows (32- and 64-bit builds). You
don't need to compile ocaml and often used libraries from source. For
convenience, there are also packages for often used external
c-libraries (pcre, tcl/tk, gmp, gtk, ... ).

- a gtk-based gui for package management that hides the cygwin shell
and the godi console from casual users.

- patched source packages and build instructions for windows.


More details: 
  
** Deep in this thread, Andreas said and Edgar Friendly replied:

> godi-zip is indeed broken. I've updated godi-zip to version 1.05 and
> hopefully fixed it.

On this note, I realize that I have not announced to this list that
camlzip has released version 1.05 with findlib support (and an
official findlib package name). There are no changes to the library
code, just an extra line in the makefile for installing with findlib
and a simple META file.
  

3) Parmap package in OPAM
Archive: 

** Francois Berenger announced:

For those living on the edge of source-based installers
for OCaml software and libraries, this e-mail
is just to let you know that a Parmap package is
available in the OPAM repository
().

Thanks to Thomas Gazagnaire, Roberto Di Cosmo
and maybe others who contributed!
  

4) Fan hosted on github now
Archive: 

** Bob Zhang announced:

I have moved Fan into github now ().

What's Fan? We see that a lot of computer scientists are creating
languages to target their domain, but creating a language is itself a
domain, Fan is targeted at this domain. Yes, Fan is targeted to
compiler domains. Fan aims to make creating a language easier.

Fan is a successor to Camlp4, which was mainly developed by Daniel de
Rauglaudre and Michel Mauny, and later was largely renovated by
Nicolas Pouillard. Fan is way more faster than Camlp4, generally 100
times faster (bootstrapping using native version only takes 4s in my
machine) and Fan has a very robust bootstrapping system compared with
Camlp4. Fan has all the features that Camlp4 provides and much more.

Currently Fan is not usable, (so users should still stick to Camlp4
for one year or two) mainly because the API is un-stable, yet. But I
would be happy to hear feature request. I am open to pull request.

No documentation yet, but there's a link to the previo

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-10-09 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of October 02 to 09, 2012.

1) OCaml 4.00.1 released
2) Macaque 0.6
3) Yypkg 1.6.0
4) Camlp5 6.07 compatible with OCaml 4.00.1 released
5) Mingw-builds 1.1 rc1
6) Other Caml News


1) OCaml 4.00.1 released
Archive: 

** Damien Doligez announced:

We have the pleasure of celebrating the birthdays of Denis Diderot
by announcing the release ofOCaml version 4.00.1.
This is mainly a bug-fix release, see the list of changes below.

It is available here: 

This is released as source for the time being, but the binary
versions should be available soon.

We would like to take the opportunity to thank all the packagers
out there who make this easy to install for end users without
recompiling.

Happy hacking,

-- Damien Doligez for the OCaml team.


OCaml 4.00.1:
-

Bug fixes:
- PR#4019: better documentation of Str.matched_string
- PR#5111: ocamldoc, heading tags inside spans tags is illegal in html
- PR#5278: better error message when typing "make"
- PR#5468: ocamlbuild should preserve order of parametric tags
- PR#5563: harden Unix.select against file descriptors above FD_SETSIZE
- PR#5690: "ocamldoc ... -text README" raises exception
- PR#5700: crash with native-code stack backtraces under MacOS 10.8 x86-64
- PR#5707: AMD64 code generator: do not use r10 and r11 for parameter passing,
as these registers can be destroyed by the dynamic loader
- PR#5712: some documentation problems
- PR#5715: configuring with -no-shared-libs breaks under cygwin
- PR#5718: false positive on 'unused constructor' warning
- PR#5719: ocamlyacc generates code that is not warning 33-compliant
- PR#5725: ocamldoc output of preformatted code
- PR#5727: emacs caml-mode indents shebang line in toplevel scripts
- PR#5729: tools/untypeast.ml creates unary Pexp_tuple
- PR#5731: instruction scheduling forgot to account for destroyed registers
- PR#5735: %apply and %revapply not first class citizens
- PR#5738: first class module patterns not handled by ocamldep
- PR#5742: missing bound checks in Array.sub
- PR#5744: ocamldoc error on "val virtual"
- PR#5757: GC compaction bug (crash)
- PR#5758: Compiler bug when matching on floats
- PR#5761: Incorrect bigarray custom block size
  
** Hezekiah M. Carty then said:

Thank you for the new release! For anyone looking to build the new
release from source, ocamlbrew has been updated to install OCaml
4.00.1 by default:



To give it a try with the default components (OCaml, findlib, odb.ml,
oasis, utop, ocamlscript) run the following in a terminal:

curl -kL  |
bash

That will build and install everything under $HOME/ocamlbrew. See
README.md and RECIPES.md at the link above for build requirements and
other configuration examples.
  
** Jonathan Protzenko also said:

The self-installer has been updated, it is available at
. As usual, if you want to
help improve the installer script for Windows, I'll gladly accept any
patches.
  

2) Macaque 0.6
Archive: 

** Gabriel Scherer announced:

Macaque is the result of a student project aiming to develop a
type-safe and composable way to interact with SQL databases from
OCaml. We propose a form of "comprehension syntax" that allow to
modularily create queries in a strongly-typed and relatively
principled way.

## Release 0.6

After a few years of mild continuous development, people have
requested at several occasions that release be made. I therefore tag
the current state of Macaque as "0.6".

You can get an archive from the forge:


You can also get the new version from darcs:
darcs get --tag 0.6 

Thanks to everyone I have interacted with during this development;
thanks to Vincent Balat and Anastasia Gornostaeva for their feedback.
Thanks in particular to Jacques-Pascal Deplaix for his frequent
feedback and occasional suggestions and contributions.


## More Details

Macaque was initially developed at the PPS lab in Paris, under the
supervision of Jérôme Vouillon. The current development mode could be
described as "coinductive": things get done in reaction to user
requests or needs.

The technical limitations of Macaque are the following:

- It only support PostGreSQL (from lack of time to develop
other backends).

- Each feature of the SQL language must be consider

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-10-02 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of September 25 to October 
02, 2012.

1) release Javalib 2.2.2 and Sawja 1.4
2) OCaml-RDF 0.1
3) Ocamldap New Maintainer
4) Ocamldap 2.2
5) Other Caml News


1) release Javalib 2.2.2 and Sawja 1.4
Archive: 

** Pierre Vittet announced:

We have the pleasure to announce a new release of Javalib and Sawja
(the Static Analysis Workshop for JAva).

Javalib and Sawja are libraries written in OCaml. Javalib parses Java
.class files into OCaml data structures. Sawja is relying on the
Javalib library, and providing a high level representation of Java
bytecode programs. Whereas Javalib is dedicated to isolated classes,
Sawja handles bytecode programs with their class hierarchy and control
flow algorithms. Sawja also provides some stackless intermediate
representations of code and static analysis tools that makes analyses
easier.

The main new feature of this release is the ability to use formulae.
It is a way to add information at the source code level which can then
be used in an analysis. It is useful, for example, to guarantee
assertions that cannot be found by the analyser or even to manage
structures/functions which are implicitly present in the code environment.

More information, examples, and a series of tutorials are available at
. The Sawja devteam is looking forward to your
questions and feedback on the library.
  

2) OCaml-RDF 0.1
Archive: 

** Maxence Guesdon announced:

It is my pleasure to announce the first release of OCaml-RDF:


OCaml-RDF is a native OCaml library to manipulate RDF graphs.
  

3) Ocamldap New Maintainer
Archive: 

** Eric Stokes announced and Jacques-Pascal Deplaix added:

> Jacques-Pascal Deplaix is taking over the Ocamldap project. I've
> enjoyed working on it over the years, but no longer have time to
> devote to it. He will follow up with details.

For information for those interested, this release (2.2) is based on the
"stable" trunk (branches/OCAMLDAP_2_0).
The next release will be based on the main trunk, without the lasts
"unstable commits" (doesn't compiles since 2006).

Also, for information, the stable branch is under "LGPL" and the main
trunk in under "LGPL with the special ocaml linking exception". So, the
next release will have the special ocaml linking exception.

The old svn repository:
* 
  

4) Ocamldap 2.2
Archive: 

** Jacques-Pascal Deplaix announced:

I'm happy to announce the version 2.2 of Ocamldap with the following changes:

 * OCaml 4 compatibility
 * Modularize the library in sub-libraries: ldap ldap.ldif ldap.toplevel
 * Use oasis
 * Repository cleaning
 * Maintainer changed (Thanks to Eric Stokes)
 * Switch from svn to git

The new repository is available at:

 * 
 * 
 * 

(Use the one you want)
  

5) 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 .

Announcing Ohm, an OCaml Web Framework:
  

The Ocsigen cheatsheet:
  

Ocamldap:
  

Delimited Overloading 0.8.15:
  

Substitution is pullback:
  

Programming Tools UX: When Statically Compiled Feels Dynamic:
  

Jane Street at OUD:
  

OCaml Users and Developers slides and videos:
  

  
=

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-09-25 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of September 18 to 25, 2012.

1) Call for collaboration on the future of camlp4
2) OUD slides
3) OCaml 4.00.0 for iOS Simulator is released
4) Other Caml News


1) Call for collaboration on the future of camlp4
Archive: 

** Bob Zhang said:

This triggered a lively discussion. Please follow the
archive link above to read it all.

Last week, I give a talk about the future of Camlp4 in the ML
workshop, the slides are here
 (some are already
done, some are work in progress).

For a long time, in the caml community, thanks to the talented work of
Daniel and Michel, we know there is a very very powerful tool called
*camlp4*, if there are some bolierpolate code you write here and
there, someone will tell you "hey, you can do it in camlp4" though he
may not know how to do it in camlp4.

But it's a bit embarassing that camlp4 did not evolve very well(partly
due to the fragmentation of camlp[4,5]), another fact is that camlp4
is not *designed*, it's like a prototype that works but not carefully
designed, and it does not provide anything out of the box and itself
was written in a verbose way.

It's time to bring the powerful tool back, my advisor Steve and I
started a new project Fan, which is mainly to evolve the camlp4 macro
system to be more expressive and more powerful, push the Camlp4 to the
next level. For me, I am a long-term Lisp programmer, I appreciated
the value of macros, I would really be happy to see we could make a
such powerful macro systems.

Here is my repo 

I already finished some cool staff, to mention just a few:

1. A very robust bootstrapping system, previously it takes me 20
minutes to verify my patches to camlp4 can reach a fixpoint or not,
but now you can compile your modification within seconds, and reach a
fixpoint under 2 minutes, this accelerate the development cycles
immediately.

2. Now you can customize your lexer now, previously it's impossible(
and a number of bug fixes) you can do deep anti-quotation like
:expr< <:expr< $($(deepantiquot)) >> >>

3. Linking the compiler and a number of cool features (see the slides)

4. A macro which write macros to scrap all the bolierpolate code for
generic programming, now you can customize your deriving stuff in ten
lines (previously thousands of lines of code to write camlp4 plugin)

5. A number of mini-DSLs and more to be expected

I love macros, I would commit to the project for a long time(probably
my Ph.D term), I promise that I would write the documentation to make
users happy( I am also writing a book about macros, it's un-readable
though). And I am really happy to co-laborate with anyone who love
camlp4.

Syntax matters, if you see that coffescript is now already a success,
camlp4 or Fan is actually more expressive than that, Dear ocaml
programmers, let us find a way to make ocaml more beautiful. I am also
open minded to any discussion about the future of camlp4
  

2) OUD slides
Archive: 

** Philippe Veber asked and David House replied:

> as one of the poor souls that could not make it to this year's caml
> meeting, I'd like to know if the slides of the presentations will be
> available at some point. Thanks!

You can see all of the videos here:



As for slides themselves: the slides for the Async and debugging talks
will be up on the Jane Street website as soon as Mark remembers to
grab them off of his laptop...
  
** Anil Madhavapeddy also replied:

I've linked all of the videos, abstracts and slides that are available at the
OUD website, at:



As speakers send me their slides, I will update the web page (this is
possibly slightly challenging from some talks such as David Scott's, which
was delivered as a self-hosted webserver using Mirage).

I've also got various scribe reports from attendees that I will collate into
a summary blog post next week, and mail out to the list.   
  

3) OCaml 4.00.0 for iOS Simulator is released
Archive: 

** Jeffrey Scofield announced:

I just released a version of OCaml 4.00.0 that creates apps that run in
the iOS Simulator. I call it OCamlXSim for short.

You can download a binary release, or get instructions for bulding from
sou

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-09-18 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of September 11 to 18, 2012.

1) A question about Format boxes
2) OCaml-SPF 1.0.0
3) OCaml-SRS 1.0.0
4) OCaml-Milter 1.0.0
5) Release 1.0.0 - A multi-process daemon framework for OCaml
6) OCaml 4.00.0 for iOS is released
7) Slides of ML workshop
8) Other Caml News


1) A question about Format boxes
Archive: 

** Michael Welsh Duggan asked and Martin Jambon replied:

> The example at
> 
> shows a major difference in the output of packing versus structural hov
> boxes. However, in my experiments I cannot achieve the output this
> example assigns to "packing" boxes. (OCaml 3.12)
> 
> My examples from the REPL are below. Would someone be able to tell me
> what I am doing incorrectly?
> 
> # Format.printf "@[(---@\n@[(---@\n@[ 2>(---@,)@]@,)@]@,)@]@\n";;
> (---
> (---
> (---)))
> - : unit = ()
> # Format.printf "@[(---@\n@[(---@\n@[ 2>(---@,)@]@,)@]@,)@]@\n";;
> (---
> (---
> (---)))
> - : unit = ()
> # Format.printf "@[<2>(---@\n@[<2>(---@\n@[<2>(---@,)@]@,)@]@,)@]@\n";;
> (---
> (---
> (---)))
> - : unit = ()
> # Format.printf "@[(---@\n@[(---@\n@[(---@,)@]@,)@]@,)@]@\n";;
> (---
> (---
> (---)))
> - : unit = ()

I have no idea what you're doing wrong, but I can suggest you try
easy-format () which lets you
choose and customize various indentation styles.
  

2) OCaml-SPF 1.0.0
Archive: 

** Andre Nathan announced:

I'm happy to announce the availability of OCaml-SPF 1.0.0, a library
that provides OCaml bindings to libspf2[1]. The module allows SPF
(Sender Policy Framework) verifiers to be written in OCaml.

Github repostory: 
Forge download: 
ODB package page: 

Best regards,
Andre

[1] 
  

3) OCaml-SRS 1.0.0
Archive: 

** Andre Nathan announced:

I'm happy to announce the availability of OCaml-SRS 1.0.0, a library
that provides OCaml bindings to libsrs2[1]. The module provide functions
to perform email address rewriting with SRS (Sender Rewriting Scheme).

Github repostory: 
Forge download: 
ODB package page: 

Best regards,
Andre

[1] 
  

4) OCaml-Milter 1.0.0
Archive: 

** Andre Nathan announced:

I'm happy to announce the availability of OCaml-Milter 1.0.0, a library
that provides OCaml bindings to libmilter[1]. This module allows one to
use OCaml to write applications that integrate with SMTP servers like
Postfix and Sendmail via the milter interface.

Github repostory: 
Forge download: 
ODB package page: 

Best regards,
Andre

[1] 
  

5) Release 1.0.0 - A multi-process daemon framework for OCaml
Archive: 

** Andre Nathan announced:

I'm happy to announce version 1.0.0 of the Release daemon
framework for OCaml:

Github repository: 
Forge download: 
ODB package page: 

>From the README:

Release is a multi-process Lwt-enabled daemon framework for
OCaml, providing facilities for type-safe inter-process
communication and privilege-dropping.

Its goal is to make it easy to write servers that are
released from the calling terminal and to release root
privileges when those are not necessary.

Release provides the following features:

- Easy creation of 1-to-1 master-slave or 1-to-n master-slaves
process architectures;
- Type-safe and thread-safe interprocess communication;
- Supervisor features (the m

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-09-11 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of September 04 to 11, 2012.

1) existing implementation of data structures for storing points/doing nearest 
neighbour search in OCaml
2) [CUFP 2012] Birds of a Feather sessions
3) Uunf 0.9.0 and Uucd 0.9.0
4) Other Caml News


1) existing implementation of data structures for storing points/doing nearest 
neighbour search in OCaml
Archive: 

** Francois Berenger asked:

I was looking for a few data structures to accelerate some geometric
operations on 3D point sets. I was happily surprised. The harvest was
gorgeous:

kd-tree in OCaml:
- 

R-tree in OCaml:
- 

Vantage point tree in OCaml:
- 
  
** Siraaj Khandkar then added:

 Quadtree:
- 
  

2) [CUFP 2012] Birds of a Feather sessions
Archive: 

** Ashish Agarwal announced:

Birds of a Feather sessions (BOFs)

Commercial Users of Functional Programming Workshop (CUFP 2012)

Copenhagen, Denmark, September 13 - 15


CUFP 2012 will again include Birds of a Feather sessions as in
previous years. BoFs provide a place for our community to gather
informally and reach consensus on matters of importance. Any CUFP
attendee can propose a BoF session, and grab one of the spare rooms in
the evening slots below. Attendance in the evening is open to all.

BoF sessions facilitate ad-hoc discussions and provide a place to
gather and start off the chat, before moving on during the evening to
a local restaurant or pub. There is no deadline for proposing a
session---you can even request a room on the day---but we encourage
you to do so at the earliest possible time to help us with planning
and to publicize your proposed discussion. Attendees are also free to
show up even if you have not confirmed, but again earlier confirmation
will help us with planning.

Please see  for details on how to propose a
BoF session or confirm attendance at one of them.

General information on CUFP 2012 can be found at
. The conference is co-located with
ICFP. You can register for CUFP at the main ICFP website
.
  

3) Uunf 0.9.0 and Uucd 0.9.0
Archive: 

** Daniel Bünzli announced:

I'd like to announce the following two modules. First Uunf:

Uunf is an OCaml module for normalizing Unicode text. It supports all
Unicode normalization forms and is independent from any IO
mechanism or Unicode text data structure. Text can be processed
without a complete in-memory representation.

Uunf is made of a single independent module and distributed under the
BSD3 license.

Project homepage: 
API doc & examples: 


Note that if you use `findlib` to install you'll need Uutf because it used by

the sample programs, but using Uunf itself doesn't actually require Uutf.


For those what wonder what this is about, Unicode normal forms are
needed if you want to test Unicode strings for equality via binary
equality or order them in a textually *unmeaningful* way via
binary comparison e.g. for Set.Make or Map.Make.

This is because in Unicode there is more than one way to represent the
same user perceived character, e.g. é can be represented by the sequence
 (precomposed character é) or  (character e
followed by non-spacing mark ´). Normalizing all your strings to a
given normal form ensures that all equivalent subsequences in them
are represented the same way.



The second module is Uucd:

Uucd is an OCaml module to decode the data of the Unicode Character
Database from its XML representation. It provides high-level (but
not necessarily efficient) access to the data so that efficient
representations
can be extracted.

Uucd is made of a single module, depends on Xmlm and is
distributed under the BSD3 license.



Project home page: 
API doc: 


If you want to install the modules via odb here are a few line
you can add to your odb package file:



(these things are still not in oasis-db because uploads of .tbz is
currently broken)
  
===

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-09-04 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of August 28 to September 04, 
2012.

1) xtmpl 0.2 and stog 0.2
2) Mascot 1.0 release
3) Kaputt 1.2 release
4) JoCaml 4.00.0 release
5) ocaml-lua v1.0: OCaml binding of Lua library
6) PROMELA library 0.4
7) ocaml-4.00.0 compilation problem with first class modules and optional 
parameters
8) hevea 2.00
9) Other Caml News


1) xtmpl 0.2 and stog 0.2
Archive: 

** Maxence Guesdon announced:

I'm happy to announce Xtmpl 0.2 is available from

Xtmpl is a rewrite engine / templating library for Xml trees. This release
includes only minor changes.

I'm even happier to announce Stog 0.2, available from


Stog is a static multi-lingual web site and blog generator.
A lot of changes in this release, including: Processed files are now only
XML (no ad hoc format any more). The system is more flexible, more
convenient also. Documentation was updated accordingly.
  

2) Mascot 1.0 release
Archive: 

** Xavier Clerc announced:

This post announces the 1.0 release of the Mascot project, whose goal is to
provide a style-checker for OCaml sources.

Home page: 

Main changes since 1.0-beta:
- support for checks based on binary annotations
- support for binary output mode, and report-only mode
- new code check: 'catch_all' to detect patterns catching all
exceptions
- new code check: 'code.ignore_unit' check to detect application of
'ignore' to expression whose type is 'unit'
- bug #72: allow punctuation after closing a block
- bug #74: handle the '::' operator
- bug #75: do not require whitespace after '?' used for optional label
- bug #76: do not require whitespace around '..' used for character
range
- bug #77: allow absence of whitespace before unary minus if previous
token is an opening one
- bug #79: treat '[< ... >]' and '[| ... |]' blocks like '{ ... }'
blocks
- bug #80: allow whitespace after '.' when used to introduce
polymorphic type
- bug #81: allow opening token after a label
- bug #84: use 'center' rather than 'p' tag with 'align' attribute,
and correct handling of icons
- bug #87: install shouldn't build anything
- bug #89: do not activate warnings by default
- bug #90: output available checks as a ready-to-use config
- bug #93: 'interface.duplicate' to detect duplicate entries in
signatures
- bug #94: do not require whitespace after colon
- bug #96: 'typography.trailing_white_space' now has a 'tolerance'
parameter in order to indicate how many whitespace characters may be
tolerated
- update for OCaml 4.00.0
  

3) Kaputt 1.2 release
Archive: 

** Xavier Clerc announced:

This post announces the 1.2 release of the Kaputt project, whose goal is to
provide a comprehensive testing framework for the OCaml language.

Home page: 

Main changes since 1.1:
- new 'Mock' module providing means of recording calls made to a function
- support for specification of partial functions (i. e. raising exceptions)
- preprocessor allowing to store tests in separated '.mlt' files
- removed deprecated functions
- update for OCaml 4.00.0
- bug#85: cmi file is not installed
- bugfixes to bigarray and nums support
  

4) JoCaml 4.00.0 release
Archive: 

** Luc Maranget announced:

It is my pleasure to announce the new release (4.00.0) of JoCaml.

JoCaml is the concurrrent and distributed extension of OCaml based upon
the join-caculus.

The new release follows OCaml evolution, it may be that the integration
of OCaml new features such as GADT and binary annotations is far
from perfect...


The new release is available from JoCaml web site:

  

5) ocaml-lua v1.0: OCaml binding of Lua library
Archive: 

** Paolo Donadeo announced:

I'm happy to announce the first release of ocaml-lua, the OCaml
binding of the Lua library. With ocaml-lua you can embed a Lua
interpreter in an OCaml program in a few 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-08-28 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of August 21 to 28, 2012.

1) Lablwebkit 1.8.2
2) OCaml app in the Mac App Store
3) State of Saffire or other FFI-checkers
4) Companies using OCaml
5) LablGtk 2.16.0
6) Is there a printer for ocaml's parsetree
7) Thread-private data in C stubs
8) Other Caml News


1) Lablwebkit 1.8.2
Archive: 

** Adrien Nader announced:

I am happy to announce the 1.8.2 release of lablwebkit which is a
binding to the corresponding webkit-gtk version. Almost all of its API
besides the DOM-related function is handled.

This new version is an update to the new webkit-gtk API and doesn't
introduce other changes.

The bindings are generated automatically by cowboy[1] and its support
for glib2-based libraries.

You can download the source at:


[1] 
  

2) OCaml app in the Mac App Store
Archive: 

** John Whitington announced:

Our PDF Editor, mostly written in OCaml, is now in the mac app store:



There weren't any problems with sandboxing, developer-signing or app
store approval for an executable with OCaml code in it.
  

3) State of Saffire or other FFI-checkers
Archive: 

** Adrien Nader asked:

I regularly stumble on Saffire which is an FFI-checker. Its webpage is
dead but still accessible (along with a release tarball) through
archive.org:



I've fixed the build system a bit but it seems to be missing a module
named "MLast" and I'm quite obviously stuck on that.

Has anyone updated saffire? Or has build sources that work? Or something at 
all?

Or are there other checkers?
  
** After several replies, Adrien announced:

I've created a project on the OCaml forge for Saffire:

Git: 

I've commited several fixes so far but it's not building yet.

Right now, building yields the following error:
File "src/ext/ffi/ffi_common.ml", line 208, characters 8-35:
Error: Unbound constructor MLast.RfTag

I've checked in all the camlp5 releases and none of them mentions
RfTag; only 4 commits in the ocaml sources mention it and I couldn't
see any documentation about it (saffire was built against ocaml 3.08).
Also, unfortunately, I don't know camlp5.

If you're interested in Saffire, you can become a commiter or simply
submit patches. The work to simply see which results it can bring is
probably minimal; it it proves useful in practice, there can also be
more work (like maybe using bin-annot instead of being a wrapper
around ocaml{c,opt} and using camlp4).
  

4) Companies using OCaml
Archive: 

** Continuing the thread from last week, Paolo Donadeo said:

Sorry, I completely missed this thread. For what it's worth, you can
add Italy, and Studio Associato 4Sigma: 

We are a small firm and we make web sites (90% of our work) and some
interesting web application (10%). OCaml is not our main language but
is used here and there, and I wrote a small server that is a key
component of a service we offer our customers.
  
** David Baelde also said:

I have a few observations that may be relevant for your "company" or
"success" pages.

First, Nicolas Cannasse (main developper of HaXe) has recently left
Motion Twin for another French company, Shiro Games
(). I'm not sure that Motion Twin still counts
as a user of OCaml, it seems possible that they are now only using the
HaXe compiler, whose development would have followed Cannasse at Shiro
Games.

Second, I think that liquidsoap () should be added
to the list of successes. As a main developer of the project, I am not
neutral, but I believe that our tool is clearly well established in
the (internet) radio industry. Liquidsoap is well known as a tool with
unique abilities, and has lots of users including big commercial ones.
It is not developed as a busines

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-08-21 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of August 14 to 21, 2012.

1) OCaml-Java 2.0 preview: call for testers
2) Companies using OCaml
3) Other Caml News


1) OCaml-Java 2.0 preview: call for testers
Archive: 

** Continuing this previous thread, Xavier Clerc said:

> Tried this out on Windows under cygwin and had a couple of problems.
> CCing caml-list in case anybody else has run into similar.
> 
> 1) There's some special code in bin/common to check for cygwin and use
> cygpath to convert JAVA_HOME to a UNIX-style path. That works...
> except in the case that there's a space in the path (which there
> almost certainly is on Windows). Each of the scripts (bin/ocaml
> bin/ocamljava, etc.) should use "$OCJ_JAVA" instead of $OCJ_JAVA (that
> is: quote the variable so that spaces aren't interpreted as separate
> tokens). With this change, the scripts call Java correctly.
> 
> 1a) It might be appropriate to see if "java" is on the path and try to
> use that if JAVA_HOME is not set (as it was not on my machine). The
> batch files appear to do this already (and quote %OCJ_JAVA%, as well.)
> 
> 2) With that change, ocamljava still didn't run right away. It
> appears to be because it's trying to parse the CLASSPATH environment
> variable, but it's using UNIX rules to do so. Since I don't know
> what's going on inside, I can't say exactly why, but I can report the
> error message:
> 
> File "test.ml", line 1, characters 0-1:
> Error: Classpath error: ".;C" does not exist
> 
> (This happens with whatever input is provided to ocamljava.)
> 
> Two things here:
> 
> 2a) It's interpreting the CLASSPATH as using : as a separator, whereas
> it's actually using ; as a separator. So, it sees ".;C:\..." and
> thinks the first segment is ".;C"
> 
> 2b) Even though it's interpreting the CLASSPATH wrong, it probably
> still should not be an error for the CLASSPATH to contain paths that
> do not exist. Those should be ignored, rather than triggering an
> error.

Thanks for your detailed report. I have fixed all these issues, and
uploaded a new version of the archive. Would you be kind enough to
test if everything is fixed on your installation too?
The address is the same:



> Finally, even though a stated goal is to be able to use Java's
> libraries from OCaml code, there doesn't seem to be any documentation
> on how to actually do that. I tried using external just in case, but
> if that's the mechanism I'm not sure how it's meant to be used. A
> little guidance on how to call into Java from OCaml would be
> appreciated. This would be helpful both to test that it works
> correctly and to figure out if the abstraction that's provided is
> adequate.

Well, I provided no guidance because the current build does not
include the typer extensions allowing to manipulate Java elements
from OCaml code. Such extensions are not complete yet (some tests
are missing, and arrays are not handled yet), and will be integrated
in a future build (hopefully in september).

In the meantime, here is how it works. Some "special" functions behave
as "printf", meaning that their actual type is based on a "format"
string literal. For example,
Java.make "javax.swing.JButton(java.lang.String,javax.swing.Icon)" (x, y)
will create a "javax.swing.JButton" instance. The OCaml type of the
instance is "javax'swing'JButton java_instance" where "java_instance"
is a particular type whose parameter designates a Java class name
where dots are replaced by simple quote (to fit OCaml syntax).
  

2) Companies using OCaml
Archive: 

** Esther Baruk announced:

Some of you might already have heard about the OCaml Website project
started after its announcement at the last OCaml Meeting in April
2011.

There will be a page on the website where we list all companies using
the OCaml language.

We listed almost all well known companies (see the list at the end of
this mail), with a small description of the use of OCaml in the
corresponding company.

We wish to enrich this list as much as possible.

So, if you know or work in a company using OCaml and that is not in
this list, please tell us. And if you see some detailed descriptions
that need to be updated, let us know.

We also welcome new contributors to the project. You can submit pull
requests on Github () and also
suggest content to add, etc. We have a mailing list where you can
subscribe:


Editor's note: follow the archive lin

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-08-14 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of August 07 to 14, 2012.

1) postdoc positions at INRIA Saclay
2) extlib-1.5.3
3) Bisect 1.2 release
4) Bolt 1.3 release
5) Other Caml News


1) postdoc positions at INRIA Saclay
Archive: 

** Fabrice Le Fessant announced:

New postdoc positions at INRIA Saclay
OCaml performance, memory management and multicore

Job description:

We are currently looking for two one-year postdocs at INRIA Saclay[0],
to work on improving OCaml memory management, particularly in the
context of multicore systems. The candidate would contribute either to
the implementation of the OCaml runtime, to benefit from multicore
systems, or to the implementation of compiler optimizations and tools
to improve the performance of theorem provers, as part of the Bware
ANR project.

INRIA Saclay is one of the most recent units of Inria, the French
public institute of Computer Science. It is located close to Paris, on
the Campus of Saclay, colocated with the University of Paris 11 and
several of the best engineer schools in France (Ecole Polytechnique,
ENSTA, Supelec, etc.).

The Bware ANR project:

Bware is a project funded by the ANR (French Research Funding Agency),
to improve "Atelier B" [1], an industrial tool to efficiently deploy
the B method, developed by Clearsy. Bware will replace the current
solver used in Atelier B by new provers developed at INRIA
(Dedukti[2], Zenon[3], Why[4], Alt-Ergo[5]), most of them written in
the OCaml language. Part of the work will be to improve the
performances of these solvers, by implementing new compiler
optimizations in OCaml and taking benefit of multicore systems. Bware
is a project gathering both academic partners (CEDRIC, INRIA, LRI) and
industrial partners (Clearsy, Mitsubishi MERCE, OCamlPro).

Requirements:

Candidates should have a Ph.D. in Computer Science, and a previous
experience of both functional programming and system/compiler
development.

Application details:

To apply, or for more information, you can contact Fabrice Le Fessant
(fabrice.le_fessant AT inria.fr).
Applications should contain a detailed
CV, with a particular focus on the experience, both theoretical and
practical, that would be useful in the context of this postdoc.

[0] 
[1] 
[2] 
[3] 
[4] 
[5] 
  

2) extlib-1.5.3
Archive: 

** ygrek announced:

Just a short note to announce extlib 1.5.3 release for the sake of OCaml 
4.00 compatibility.
Get it at 
  

3) Bisect 1.2 release
Archive: 

** Xavier Clerc announced:

This post announces the 1.2 release of the Bisect project, whose goal is to 
provide 
a code coverage tool for the OCaml language.

Home page: 

Main changes since 1.1:
- new '-combine-expr' to allow combination of results
- new 'dump' output mode (mainly for debug)
- new 'bisect' output mode (i. e. format of runtime data)
- new '-exclude-file' command-line switch to exclude toplevel functions
listed in a file
- update for OCaml 4.00.0
- bug #95: polymorphic recursion is not handled
- bug #104: configure script should be executable
  

4) Bolt 1.3 release
Archive: 

** Xavier Clerc announced:

This post announces the 1.3 release of the Bolt project, whose goal is to 
provide 
a comprehensive yet flexible logging framework for the OCaml language.

Home page: 

Main changes since 1.2:
- enhanced support for Daikon
- enhanced support for Pajé
- removed dependency upon 'Str' library
- API change: logger names now have type 'Name.t' rather than 'string'
- new configuration format (through 'BOLT_CONFIG' environment variable),
old format still available (through 'BOLT_FILE' environment variable)
- loggers are now stored in a tree, for better performances
- update for OCaml 4.00.0
  

5) Other Caml News

** From the o

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-08-07 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of July 31 to August 07, 2012.

1) Enhanced OCaml Documentation 4.00
2) OCaml-Java 2.0 preview: call for testers
3) type inference with classes
4) Yypkg 1.5.0
5) Argot: 1.1 release
6) Two questions about lex/yacc and lablgtk/gl
7) Mingw-builds 1.0 rc1
8) Other Caml News


1) Enhanced OCaml Documentation 4.00
Archive: 

** Hendrik Tews announced:

I would like to announce

The Enhanced OCaml Documentation 
Version 4.00
available via 


This version of the OCaml manual enhances the original html
version in the following way:

- Changes (wrt version 3.12) are tagged with icons and color 

- an additional appendix contains all grammar rules
  

2) OCaml-Java 2.0 preview: call for testers
Archive: 

** Xavier Clerc announced:

The OCaml-Java is a project whose goal is to allow compilation
of OCaml sources to Java bytecode, thus allowing execution on
any JVM. The objectives are to gain access to a greater number
of libraries, and to be able to take advantage of multiple cores.

Quite a lot of work has been done in order to greatly improve
the performances of the code generated by the "ocamljava"
compiler. Roughly speaking, some preliminary benchmarks
seem to indicate that ocamljava-generated code is most of
the time less than three times slower than ocamlopt-generated one.

This very mail is sent to try to gather feedback from the community.
As of today, the source is neither stabilized nor complete, and only
a binary version is available. Installation is very simple: uncompress
the archive, and put the "bin" subdirectory in your path.
More information can be found in the "README" file of the archive.
The archive can be downloaded at the following address:


For this version, I am mostly interested in compatibility reports,
and performance considerations. Although the compiler is already
able to compile itself, it is probably wise to start with smaller
examples...
  

3) type inference with classes
Archive: 

** Ivan asked and Alain Frisch replied:

> I've mentioned that in some cases ocaml can't infer type (or maybe it
> can, but didn't want to...) of some objects.
> Right to this moment, I've just do as ocaml wants - annotate a type and
> move forward. But now I want to make things more consciously. The reason
> is simple - sometimes ocaml infers types correctly and denotes a type
> error in my code, but I, mistakenly thinking that it can't infer type of
> object, loose my time in useless type annotating of different
> identifiers. Or vice versa, the code is correct, except for some
> undecidable object type, and I spend h^Wminutes in checking my code for
> errors.
> 
> So, I'would like to know the rules of type inference failures with
> object types. In what cases an object type can and must be inferred, and
> in what it must be annotated explicitly?
> 
> Can someone share this arcane knowledge or, at least, point me at some
> sources, explaining this issue?

I don't know if this covers all the case, but you need to keep in mind
the following points. Feel free to add to the list.

1. The type-checker will never infer that a method is polymorphic. You
need to tell it.

object(this)
method f = (this # g 1, this # g true)
method g x = x
end

===>

object(this)
method f = (this # g 1, this # g true)
method g: 'a. 'a -> 'a = fun x -> x
end


2. Same for labeled and optional arguments on methods, when the type
for the method to be called is not known.

class virtual c =
object(this)
method f = this # g ~x:1 ~y:2 + this # g ~y:1 ~x:2
end

===>

class virtual c =
object(this)
method f = this # g ~x:1 ~y:2 + this # g ~y:1 ~x:2
method virtual g: x:int -> y:int -> int
end

(Note: this is really not specific to objects, a simple (fun g -> g
~x:1 ~y:2 + g ~y:1 ~x:2) has the same effect, but it's likely to hit
you if you use virtual classes.)

3. When declaring classes, the inferred type must have no free
variable. So while the expression "object method f x = x end" is
allowed and is inferred to have a type "< f : 'a -> 'a >", the
following class declaration is rejected:

class c = object method f x = x end

Depending on what you want to do, you can either force a specific type
or make the class parametric:

class c = object method f x : 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-07-31 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of July 24 to 31, 2012.

1) Understanding Format
2) OCaml release 4.00.0
3) OCaml 4.00.0 installer for Windows
4) Building Ocaml-4.00 with GODI
5) utop 1.2
6) OUD - call for participation
7) Other Caml News


1) Understanding Format
Archive: 

** Alain Frisch asked and Olivier Andrieu replied:

> I'm trying to understand the semantics of Format boxes, and I need some
> help! Consider the following:
>
> let () =
> set_margin 500;
> open_vbox 0;
> for _i = 1 to 300 do
> open_hbox ();
> print_string "x";
> close_box ()
> done;
> close_box ()
>
>
> Format inserts line breaks, even though the page width (margin) should be
> large enough to contain 300 characters (and there is no break hint anyway).
> Why does it do it? Changing the value passed to set_margin does not seem
> to make a difference (except for small values < 70).

You have to increase the 'max_indent' parameter for the formatter too :



When you open your hbox, you get an implicit break if the current
cursor position is past this max_ident.
Calling set_margin does not change max_indent which keeps its default
value (68).

cf. this comment in format.ml :
(* To indent no more than pp_max_indent, if one tries to open a block
beyond pp_max_indent, then the block is rejected on the left
by simulating a break.
*)
  

2) OCaml release 4.00.0
Archive: 

** Damien Doligez announced:

Dear OCaml users,

I have been rather busy preparing the new OCaml release, and
I had no time to go shopping for a birthday present for my wife.
So... here is a little present for her:


We have the pleasure of celebrating Laïka's birthday by
announcing the release of OCaml version 4.00.0.

This is a major release with many new features, the most
important being generalized algebraic data types (GADTs),
which by themselves justify bumping the major version number.

It is available here: 

We also want to thank all the packagers out there who make
this easy to install for end users without recompiling.

Happy birthday,

-- Damien Doligez for the OCaml team.


--

There are a few changes between 4.00.0+rc1 and 4.00.0:

- PR#5692: regression in 4.00.0+beta2: end locations wrong in camlp4 ast
- PR#5694: crash in type-checker
- PR#5696: ocamldep -native does not print bytecode deps and confuses omake
- [Caml-list] #install_printer gives error in 4.00.0+rc1
- As an unintended consequence of the previous fix, this
release triggers the following warning in ocamlfind:

findlib: [WARNING] Interface topdirs.cmi occurs in several directories:
/usr/local/lib/ocaml, /usr/local/lib/ocaml/compiler-libs

We will fix it in the future, but for the time being you
can safely ignore this particular warning.


--

OCaml 4.00.0:
-

(Changes that can break existing programs are marked with a "*")

- The official name of the language is now OCaml.

Language features:
- Added Generalized Abstract Data Types (GADTs) to the language.
See chapter "Language extensions" of the reference manual for documentation.
- It is now possible to omit type annotations when packing and unpacking
first-class modules. The type-checker attempts to infer it from the context.
Using the -principal option guarantees forward compatibility.
- New (module M) and (module M : S) syntax in patterns, for immediate
unpacking of a first-class module.

Compilers:
- Revised simplification of let-alias (PR#5205, PR#5288)
- Better reporting of compiler version mismatch in .cmi files
* Warning 28 is now enabled by default.
- New option -absname to use absolute paths in error messages
- Optimize away compile-time beta-redexes, e.g. (fun x y -> e) a b.
- Added option -bin-annot to dump the AST with type annotations.
- Added lots of new warnings about unused variables, opens, fields,
constructors, etc.
* New meaning for warning 7: it is now triggered when a method is overridden
with the "method" keyword. Use "method!" to avoid the warning.

Native-code compiler:
- Optimized handling of partially-applied functions (PR#5287)
- Small improvements in code generated for array bounds checks (PR#5345,
PR#5360).
* New ARM backend (PR#5433):
. Supports both Linux/EABI (armel) and Linux/EABI+VFPv3 (armhf).
. Added support for the Thumb-2 instruction set with average code size
savings of 28%.
. Added support for position-indep

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-07-24 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of July 17 to 24, 2012.

1) Release Candidate 4.00.0+rc1
2) Ocamlnet-3.6
3) OCaml 4.00.0+rc1 installer for Windows
4) ML workshop 2012: call for participation
5) Lwt 2.4.0
6) Other Caml News


1) Release Candidate 4.00.0+rc1
Archive: 

** Damien Doligez announced:

The release of OCaml version 4.00.0 is imminent. We have
created a release candidate for your testing pleasure. Please
download the sources, compile, install, and test your favourite
software with it. Then let me know whether it works for you.

We want to know about any show-stopping bugs, especially in the
compilation and installation phases.

This release candidate is available as source code at this
address: 

Happy hacking,

-- Damien Doligez for the OCaml team.




OCaml 4.00.0:
-

(Changes that can break existing programs are marked with a "*")

- The official name of the language is now OCaml.

Language features:
- Added Generalized Abstract Data Types (GADTs) to the language.
See chapter "Language extensions" of the reference manual for documentation.
- It is now possible to omit type annotations when packing and unpacking
first-class modules. The type-checker attempts to infer it from the context.
Using the -principal option guarantees forward compatibility.
- New (module M) and (module M : S) syntax in patterns, for immediate
unpacking of a first-class module.

Compilers:
- Revised simplification of let-alias (PR#5205, PR#5288)
- Better reporting of compiler version mismatch in .cmi files
* Warning 28 is now enabled by default.
- New option -absname to use absolute paths in error messages
- Optimize away compile-time beta-redexes, e.g. (fun x y -> e) a b.
- Added option -bin-annot to dump the AST with type annotations.
- Added lots of new warnings about unused variables, opens, fields,
constructors, etc.
* New meaning for warning 7: it is now triggered when a method is overridden
with the "method" keyword. Use "method!" to avoid the warning.

Native-code compiler:
- Optimized handling of partially-applied functions (PR#5287)
- Small improvements in code generated for array bounds checks (PR#5345,
PR#5360).
* New ARM backend (PR#5433):
. Supports both Linux/EABI (armel) and Linux/EABI+VFPv3 (armhf).
. Added support for the Thumb-2 instruction set with average code size
savings of 28%.
. Added support for position-independent code, natdynlink, profiling and
exception backtraces.
- Generation of CFI information, and filename/line number debugging (with -g)
annotations, enabling in particular precise stack backtraces with
the gdb debugger. Currently supported for x86 32-bits and 64-bits only.
(PR#5487)
- New tool: ocamloptp, the equivalent of ocamlcp for the native-code compiler.

OCamldoc:
- PR#5645: ocamldoc doesn't handle module/type substitution in signatures
- PR#5544: improve HTML output (less formatting in html code)
- PR#5522: allow refering to record fields and variant constructors
- fix PR#5419 (error message in french)
- fix PR#5535 (no cross ref to class after dump+load)
* Use first class modules for custom generators, to be able to
load various plugins incrementally adding features to the current
generator
* PR#5507: Use Location.t structures for locations.
- fix: do not keep code when not told to keep code.

Standard library:
- Added float functions "hypot" and "copysign" (PR#3806, PR#4752, PR#5246)
* Arg: options with empty doc strings are no longer included in the usage 
string
(PR#5437)
- Array: faster implementations of "blit", "copy", "sub", "append" and 
"concat"
(PR#2395, PR#2787, PR#4591)
* Hashtbl:
. Statistically-better generic hash function based on Murmur 3 (PR#5225)
. Fixed behavior of generic hash function w.r.t. -0.0 and NaN (PR#5222)
. Added optional "random" parameter to Hashtbl.create to randomize
collision patterns and improve security (PR#5572, CVE-2012-0839)
. Added "randomize" function and "R" parameter to OCAMLRUNPARAM
to turn randomization on by default (PR#5572, CVE-2012-0839)
. Added new functorial interface "MakeSeeded" to support randomization
with user-provided seeded hash functions.
. Install new header  for C code.
- Filename: on-demand (lazy) initialization of the PRNG used by "temp_file".
- Marshal: marshalling of function values (flag Marshal.Closures) now
also works for functions that come from dynamically-loaded modules (PR#5215)
- Random:
. More random initialization (Random.self_init()), using /dev/urandom
when available (e.g. Linux, FreeBSD, MacOS X, Solaris)
* Faster implementation of Random.float (changes the generated sequences)
- Scanf: new function "unescaped" (PR#3888)
- Set and Map: more efficient implementation of "filter" and "partition"
- String: new functio

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-07-17 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of July 10 to 17, 2012.

1) Returning an element computed with Toploop
2) library/framework needed for distributed programming in OCaml
3) Opportunité chez Esterel Technologies !
4) Coherent Graphics Product Updates
5) OUD - call for participation
6) Other Caml News


1) Returning an element computed with Toploop
Archive: 

** Jean-Baptiste asked and Jeannin Edgar Friendly replied:

> Thanks to Jonathan Kimmitt on this mailing list, I learned about the 
> existence of the Toploop module, that allows to execute OCaml code from a 
> string. For example, one can do:
> 
> # Toploop.execute_phrase true Format.err_formatter
> ((!Toploop.parse_toplevel_phrase) (Lexing.from_string "355./.113.;;"));;
> - : float = 3.14159292035398252
> - : bool = true
> 
> However I could not find any official documentation of the module on the 
> internet. In particular, the example above only prints out what was computed 
> and returns a boolean (true or false), depending on how the computation 
> terminated. I would like to compute an element and get the element back to be 
> able to use it later in the computation. Is that possible and how could I do 
> it?

The documentation for Toploop may not be on the net nicely anywhere;
here's the best link I have:


As far as your problem, you want the `Toploop.getvalue` function; for
an example, see
 specifically
the section "Referring to Packages Indirectly". Be warned that the
results are quite type unsafe.
  
** Hongbo Zhang also replied:

The codebase for toplevel/ is pretty small, IMHO, reading the source
is best way to understand how toploop works.

There's another non-trivial example in camlp4/Camlp4Top which shows
you how to customize toplevel. If you understand how it works, feel
free to use it, it's pretty safe :-)

** Kimmitt, Jonathan Richard Robert also replied:

If you have a complicated piece of code it might be better to use
Lexing.from_file instead of Lexing.from_string.

Also the evaluations made in the top-level will be cumulative:

you could do:

open "Jean";;

results := ["cats";"dogs";"fish];;

This assumes the module "jean.ml" previously compiled has a "let result = ref 
[];;"

By this means data can be exchanged between top-level and your own module.

If the last calculation in your parsed string/file has type unit, nothing 
will be printed, apart from status

I don't think there is anything type-unsafe about it, or any
difference with the normal top-level really, just you need to be aware
the expressions are not checked at compile time, so you need to be
careful to check for errors.


2) library/framework needed for distributed programming in OCaml
Archive: 

** Francois Berenger asked:

Please forgive me to open this possibly re-occurring thread
but I need an up to date version of the answer.

I once wrote a parallel and distributed toy program in Python which
proved to be quite useful
().  It was quite simple and
easy to write because I used a "library that enables you to build
applications in which objects can talk to each other over the network"
().

So, I am looking for the gold standard to write
modules in OCaml that can talk to each other over the network
(not objects, I don't like them so much).

Here are some requirements, in a random order:

- the target execution environment is composed of
about 10 Linux workstations. It may switch to 1 or
2 interconnected clusters in the future (about 512 cores max).
So, not as large a scale as a company doing big data.
- the system will be used to transfer files of various sizes
(big files like a few Gb included, tiny ones also)
- pure OCaml code, so JoCaml and CamlP3l are out.
I don't like so much if there is some C part in the library
but this is not a show stopper.
- I really dislike syntax extensions (or things that force
me to do a lot of sysadmin strange configuration) so user-land only
would be great
- preserving type-safety and abstraction as mentioned
in the Quicksilver/OCaml paper would be cool (

) but not mandatory.
Ideally, encryption or compression of communications should
be a user-toggable feature.
- tolerance to partial failures would be nice but not
mandatory (because my target environment is not so error prone
and not 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-07-10 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of July 03 to 10, 2012.

1) ocaml top-level line editing script
2) ReML, a library for combinatorics
3) google-drive-ocamlfuse 0.1-pre2
4) Agda-style parser
5) 4.00.0 is coming
6) stream parsers with location information?
7) pretty-printing with camlp4?
8) ocaml-safepass 1.0
9) file specific outputting
10) Other Caml News


1) ocaml top-level line editing script
Archive: 

** 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] 
  
** 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)
  

2) ReML, a library for combinatorics
Archive: 

** 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: 


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: 
  

3) google-drive-ocamlfuse 0.1-pre2
Archive: 

** Alessandro Strada announced:

I'm developing a FUSE filesystem over Google Drive using ocamlfuse.
The project is hosted on OCaml Forge
() and on github
(). I've also
uploaded the package on oasis-db
().

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 ()
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
()
and configuration
().
  
** Goswin von Brederlow suggested:

You can use my fuse bindings for ocaml:


  

4) Agda-style parser
Archive:

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-07-03 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of June 26 to July 03, 2012.

1) Camllexer v1.1.1
2) Quant position at LexiFi
3) oasis v0.3.0: Architecture for building OCaml libraries and applications
4) howto: recursively iterate over filesystem
5) Other Caml News


1) Camllexer v1.1.1
Archive: 

** Wojciech Meyer announced:

On behalf of Nicolas Pouillard, I'm happy that now Camllexer is
available as an Oasis package from [1]. The development version can be
found here [2]. The odb package manager shall be updated soon.

[1] 

As read in the distribution's README file:

"
Camllexer is an enhanced lexer for Caml dialects.

The lexer has been extracted from the Camlp4 (> 3.10) lexer, which in
turns was reimplemented as a derivative of the lexer from the OCaml
compiler.

This lexer has the following particularities:

* Correct and complete: as far as testing gone (~800_000 distinct
lines over ~3_000_000 lines of Caml like files).
* Supports most Caml dialects:
o By re-using the lexer of Camlp4 this lexer works on any
extension of the OCaml language made with Camlp4. In
particular it has a support for quotations and
anti-quotations.
o Works fine on lexers and parsers (ocamllex, ocamlyacc),
except when using the C style of comments.
* Lossless: every single bit of the input file is kept. Blanks,
comments, newlines, lexical conventions for writing literals, all
of it is kept in the returned token stream. Undesired information
can easily be thrown out of the stream.
* Keyword independent: there is no token for keywords. This is up to
you to cast some LIDENTs and some SYMBOLs into proper keyword
tokens of your own token type.
* Fault tolerant: errors take part of the token stream, allowing to
write fault tolerant translations.
* Flexible warnings: the lexer warn about some corner case of the
lexical conventions that the user might want to avoid, again
warnings take part of the token stream such that you easily
control everything.
* A simple lexer program is provided, it enables quick debugging,
and simple stream editions using Unix pipelines!
"
  

2) Quant position at LexiFi
Archive: 

** Alain Frisch announced:

LexiFi is looking to expand its team of quantitative engineers,
working on pricing algorithms for financial products and related
stuff. This position includes a part of programming, in OCaml of
course, so this might be of interest for those in this community with
a background or an interest in numerical methods and finance.

More details on the job opening: 
On LexiFi: 
  

3) oasis v0.3.0: Architecture for building OCaml libraries and applications
Archive: 

** Sylvain Le Gall announced:

A lot of changes, for this new release. 

Most important:

Fix bug with scanf %S@\n for ocaml 4.00. We were unfortunetaly using an
undocumented tolerance of Scanf in the previous version. You should
consider making new release using this version that fixed this. 

PACKAGES uploaded to oasis-db will be automatically "derived" before
OCaml 4.00 release (i.e. oUnit v1.1.1 will be regenerated with this new
version as oUnit v1.1.1~oasis1).

PACKAGES not uploaded to oasis-db need to be regenerated. In order not to 
break 3rd party tools that consider a tarball constant, I recommend to 
create a new version.

Thanks to INRIA OCaml team for synchronizing with us on this point.

Full article about this new release here:


Download it here:


The project:

OASIS generates a full configure, build and install system for your
application. It starts with a simple `_oasis` file at the toplevel of your
project and creates everything required.

It uses external tools like OCamlbuild and it can be considered as the glue
between various subsystems that do the job. It should support the following
tools:

- OCamlbuild
- OMake (todo)
- OCamlMakefile (todo),
- ocaml-autoconf (todo)

It also features a do-it-yourself command line invocation and an internal
configure/install scheme. Libraries are managed through findlib. It has been
tested on GNU Linux and Windows.

It also allows to have standard entry points and description. It helps to
integrates your li

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-06-26 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of June 19 to 26, 2012.

1) nlopt-ocaml
2) OCaml on Amazon EC2 Instance
3) OCamlSpotter for OCaml 4.00.0 beta
4) Compiling with camlp4 extensions
5) Other Caml News


1) nlopt-ocaml
Archive: 

** Micha? Kurcewicz announced:

This is to announce OCaml bindings to the NLopt nonlinear optimization
library. The wrapper code implements an almost complete NLopt API (the
only exception are vector-valued constraints). I am using it in my
projects without any problems, but it may still have some bugs.

You can get the source from:


  

2) OCaml on Amazon EC2 Instance
Archive: 

** Jeffrey Scofield asked:

Can anybody tell me how to install OCaml on an Amazon EC2 instance? I'm
running Amazon Linux (because it's free). None of the preconfigured
repositories seem to include OCaml itself (though a few libraries are
present if you enable EPEL 6 "Extra Packages for Enterprise Linux").

There's some indication that I need the "Optional Packages," but so far
all I have is this name. I don't know what it refers to or how to access
it from my instance.
  
** Stéphane Glondu suggested and Goswin von Brederlow added:

> You can try with Debian:
>
> 

You might also want to look into mirage (openmirage.org) for ocaml in a
cloud. (But don't ask me how to start one on amazon.)

** Siraaj Khandkar suggested:

I would use Godi:


** Jeffrey Scofield finally said:

Thanks very much for the suggestions for getting OCaml installed
on Amazon EC2. I'm going to save them for future use.

We just wanted to do some fairly quick testing, so I was looking
for something simple. Since Amazon Linux is compatible with CentOS 6,
what I ended up doing is installing the CentOS 6.2 OCaml package
on my EC2 instance. I wrote up a description of how to do it
here:



We've run our first round of tests, and it all seems to be working.

Maybe this will be useful to other OCamlers.


3) OCamlSpotter for OCaml 4.00.0 beta
Archive: 

** Jun Furuse announced:

I have put a port of OCamlSpotter to OCaml 4.00.0 beta at
 . Try the default branch.

OCamlSpotter is a source code definition/type query helper for Emacs
(and possibly for other editors). See details at
 .

Thanks to the new -bin-annot option of OCaml, OCamlSpotter no longer
requires any compiler patch. It is now a small standalone application
very easy to compile and install. It is a very quick port to OCaml 4
and the program is slower than the previous releases, but at least it
passes all the existing tests.

Probably you may be also interested in TypeRex for the same purpose.
  

4) Compiling with camlp4 extensions
Archive: 

** Aaron Bohannon asked:

I have been trying to use the new camlp4 to write an OCaml syntax extension.
All the examples I have seen so far suggest that I use the extension by
passing ocamlc the "-pp" option.  But it seems that all the location info for
error messages gets lost when I do this unless I catch and report the parse
error myself within the extension.  Is there some way to get ocamlc to report
the parse error at the correct location automatically?
  
** Gabriel Scherer replied:

All nodes in a Camlp4 AST are annotated with location information; the
locations you get from the parser are correct, and it is your
responsibility, as an extension writer, to ensure that any new nodes
you generate also have (approximately) correct location information.

If you build AST nodes "by hand", you have to provide this location
explicitly. If you use the concrete syntax quotations, the location
used is the value _loc present in the environment, whatever it may be.
So to have correct locations, you have to make sure that, at every AST
you produce through a quotation, there is a "_loc" variable in scope
with the correct value. If you match

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-06-19 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of June 12 to 19, 2012.

1) cryptokit v1.6: Cryptographic primitives
2) ocaml-fileutils v0.4.4
3) ocaml-expect v0.0.3: Expect-like framework
4) No interface to the C sysconf function in the Sys or Unix module?
5) gperftools 0.1, extunix 0.0.5
6) Call for Participation: Mancoosi International Solver Competition
7) PEPM 2013: Preliminary Call for Papers
8) Appel à communication, JFLA 2013
9) FAN 0.1
10) Commercial Users of Functional Programming 2012: Call for Presentations
11) Other Caml News


1) cryptokit v1.6: Cryptographic primitives
Archive: 

** Sylvain Le Gall announced:

Update to oasis v0.3.0~rc6

Download:


This library provides a variety of cryptographic primitives that can be used
to implement cryptographic protocols in security-sensitive applications. The
primitives provided include:

- Symmetric-key ciphers: AES, DES, Triple-DES, ARCfour,
in ECB, CBC, CFB and OFB modes.
- Public-key cryptography: RSA encryption, Diffie-Hellman key agreement.
- Hash functions and MACs: SHA-1, MD5, and MACs based on AES and DES.
- Random number generation.
- Encodings and compression: base 64, hexadecimal, Zlib compression.

Additional ciphers and hashes can easily be used in conjunction with
the library. In particular, basic mechanisms such as chaining modes,
output buffering, and padding are provided by generic classes that can
easily be composed with user-provided ciphers. More generally, the library
promotes a "Lego"-like style of constructing and composing
transformations over character streams.

Get source code:
$ svn co 

Browse source code:

  

2) ocaml-fileutils v0.4.4
Archive: 

** Sylvain Le Gall announced:

Update to oasis 0.3.0~rc6

Download:


Get source code:
$ darcs get 


Browse source code:

  

3) ocaml-expect v0.0.3: Expect-like framework
Archive: 

** Sylvain Le Gall announced:

Update with oasis v0.3.0~rc6.

Download:


This is a simple implementation of `expect` to help building unitary testing
of interactive program.

It helps to receive question and send answers from an interactive process.
You can match the question using a regular expression (Str). You can also
use a timeout to ensure that the process answer in time.

See the [Expect manual]() for more information and
example.

Homepage:


Get source code:
$ darcs get 

Browse source code:

  

4) No interface to the C sysconf function in the Sys or Unix module?
Archive: 

** Francois Berenger asked and Markus Weißmann replied:

> Wouldn't it be possible to have one?

Afaik this is on the todo list of ocaml-extunix [1].

best regards
-Markus

[1] 
  

5) gperftools 0.1, extunix 0.0.5
Archive: 

** ygrek announced:

Tonight one more new ocaml library was born, please welcome :

ocaml-gperftools 0.1


gperftools  library provides interface 
to control tcmalloc behavior. This may be useful to
ocaml programs which delegate heavy lifting to C code, hence the ocaml 
bindings.

Located at 

ocaml-extunix 0.0.5
---

ExtUnix aims to collect thin bindings to various low-level system API in one 
libra

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-06-12 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of June 05 to 12, 2012.

1) Beta release of OCaml 4.00.0
2) Parmap 0.9.9, and call for contributors
3) Distributed computing libraries
4) Windows installer for OCaml 4.00.0 beta 2
5) findlib-1.3.2 with support for ocaml-4.00
6) PXP-1.2.3 for OCaml-4.00
7) Official OCaml-4.00 patch for ocamlnet
8) ounit v1.1.2: Unit testing framework
9) OCaml-on-iOS resources updated for Lion
10) Other Caml News


1) Beta release of OCaml 4.00.0
Archive: 

** Damien Doligez announced:

The release of OCaml version 4.00.0 is approaching. We have
created a beta version for your testing pleasure. Please
download the sources, compile, install, and test your favourite
software with it. Then let me know what happened, one way or
the other.

We are especially interested in testing done on exotic
architectures (i.e. non-Linux and non-Mac, or 32-bit processors).

This beta version is available as source code at this
address: 

The version number is 4.00.0+beta2, note that beta1 was not
released.

Happy hacking,

-- Damien Doligez for the OCaml team.


OCaml 4.00.0:
-

(Changes that can break existing programs are marked with a "*")

- The official name of the language is now OCaml.

Language features:
- Added Generalized Abstract Data Types (GADTs) to the language.
See chapter "Language extensions" of the reference manual for documentation.
- It is now possible to omit type annotations when packing and unpacking
first-class modules. The type-checker attempts to infer it from the context.
Using the -principal option guarantees forward compatibility.
- New (module M) and (module M : S) syntax in patterns, for immediate
unpacking of a first-class module.

Compilers:
- Revised simplification of let-alias (PR#5205, PR#5288)
- Better reporting of compiler version mismatch in .cmi files
* Warning 28 is now enabled by default.
- New option -absname to use absolute paths in error messages
- Optimize away compile-time beta-redexes, e.g. (fun x y -> e) a b.
- Added option -bin-annot to dump the AST with type annotations.
- Added lots of new warnings about unused variables, opens, fields,
constructors, etc.
* New meaning for warning 7: it is now triggered when a method is overridden
with the "method" keyword. Use "method!" to avoid the warning.

Native-code compiler:
- Optimized handling of partially-applied functions (PR#5287)
- Small improvements in code generated for array bounds checks (PR#5345,
PR#5360).
* New ARM backend (PR#5433):
. Supports both Linux/EABI (armel) and Linux/EABI+VFPv3 (armhf).
. Added support for the Thumb-2 instruction set with average code size
savings of 28%.
. Added support for position-independent code, natdynlink, profiling and
exception backtraces.
- In -g mode, generation of CFI information and a few filename/line
number debugging annotations, enabling in particular precise stack
backtraces with the gdb debugger. Currently supported for x86 32-bits
and 64-bits only. (PR#5487)
- New tool: ocamloptp, the equivalent of ocamlcp for the native-code compiler.

OCamldoc:
- PR#5544: improve HTML output (less formatting in html code)
- PR#5522: allow refering to record fields and variant constructors
- fix PR#5419 (error message in french)
- fix PR#5535 (no cross ref to class after dump+load)
* Use first class modules for custom generators, to be able to
load various plugins incrementally adding features to the current
generator
* PR#5507: Use Location.t structures for locations.
- fix: do not keep code when not told to keep code.

Standard library:
- Added float functions "hypot" and "copysign" (PR#3806, PR#4752, PR#5246)
* Arg: options with empty doc strings are no longer included in the usage
string
(PR#5437)
- Array: faster implementations of "blit", "copy", "sub", "append" and
"concat"
(PR#2395, PR#2787, PR#4591)
* Hashtbl:
. Statistically-better generic hash function based on Murmur 3 (PR#5225)
. Fixed behavior of generic hash function w.r.t. -0.0 and NaN (PR#5222)
. Added optional "random" parameter to Hashtbl.create to randomize
collision patterns and improve security (PR#5572, CVE-2012-0839)
. Added "randomize" function and "R" parameter to OCAMLRUNPARAMS
to turn randomization on by default (PR#5572, CVE-2012-0839)
. Added new functorial interface "MakeSeeded" to support randomization
with user-provided seeded hash functions.
. Install new header  for C code.
- Filename: on-demand (lazy) initialization of the PRNG used by "temp_file".
- Marshal: marshalling of function values (flag Marshal.Closures) now
also works for functions that come from dynamically-loaded modules (PR#5215)
- Random:
. More random initialization (Random.self_init()), using /dev/urandom
when available (e.g. Linux, FreeBSD

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-06-05 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of May 29 to June 05, 2012.

1) Syntax extensions without Camlp4
2) Strange behavior from type inference after functor application
3) Core Suite 108.00.01 released
4) OCaml Users and Developers (OUD)
5) Camlp5 6.06 compatible with OCaml 4.00.0 released
6) New release of moca
7) some camlp4 documentations
8) Other Caml News


1) Syntax extensions without Camlp4
Archive: 

** Alexandre Pilkiewicz asked, triggering a big thread from which some messages 
follow:

I was surfing the web, and found this one year old blog post:
 . Are they
any news on that front? That seemed very promising!
  
** Alain Frisch later said:

(The new) Camlp4 has been here for several years. Documentation and tests are
still lagging behind. Nevertheless, it burns a non-negligible fraction of the
total resource spent by maintainers on OCaml (fixing bugs, struggling with
camlp4 to take new language features into account).

In addition, there is a growing consensus that the most common uses of camlp4
(such as code generation driven by type declaration) might be based on a much
simpler approach, and this would actually have advantages for the end-users
(like not changing the concrete syntax) and for developers (much less
information to grasp in order to write such an extension).

Coq is one of the few examples of a big project that relies on other aspects
of camlp4 (e.g. its parsing framework with extensible grammars). As far as I
know, it also still works with camlp5, which is actively maintained, and I
don't believe the Coq guys enjoy so much maintaining support for both camlp4
and campl5.

All that considered, and this is only a personal opinion: I don't see
compelling arguments to continue investing efforts in camlp4 itself (at least,
for the core OCaml team) and I believe it is a good time to start considering
a (medium-term) future of OCaml without camlp4. Of course, alternative
solutions need to be developed and streamlined before killing camlp4 is even
considered.

** Hongbo Zhang said and Alain Frisch replied:

>I am building a framework on top of camlp4, which provides those features
> you mentioned in the post in a flexible way. It needs to be polished. So far,
> writing generic plugins is really easy. (generic printing, comparison, lift
> filter, etc , each about 20 lines).
>The conclusion below is based on my observation and experiences. Feel free
> to correct me if I am wrong.
> 
>1. Why camlp4 is buggy?
>The main buggy part is its parsing technology.  So is its parsing
> technology a bad idea? No, it's really convenient for rapid ad-hoc
> prototyping, suppose you don't need write a lexer, and its parser simply works
> in the toplevel, the parser itself it really shorter even compared with
> menhir, if you refactor your parser part.
>The main buggy part lies in camlp4of, which is not tested at all. it's easy
> to test camlp4o, camlp4rf. There's large code base written both in camlp4o and
> camlp4rf. So in my opinion, we should just *drop camlp4of*, unless it's really
> heavily tested. *camlp4rf* is a good syntax, in my experience, it just took me
> one day to get used to, and I wrote my daily caml code in revised syntax. It's
> not hard to learn. It's much easier compared with the complexity of camlp4ast
> or ocamlast. So, IMHO, we should just advise camlp4 developers to use revised
> syntax. It would be nice if Daniel would write some articles how internal
> parser mechanism works. Revised syntax just catch up with the trunk, it should
> not be exactly the same, this gives the caml develop team enough freedom to
> introducing new constructs(monad support, etc)

I don't consider that the main problem with Camlp4 is that it is buggy, but
rather that (i) it is overly complex for the benefits it delivers, and (ii) it
is actually not such a great idea to change the concrete syntax.

Some example of useless complexity:

- A custom notion of AST. Why not simply use the OCaml one? (Extended with
nodes for a new nodes, like quotations.)

- The use of concrete syntax for manipulating the AST. The developer needs to
understand not only the new AST, but also how it is reflected exactly by the
concrete syntax quotations (and this is non trivial), and where
anti-quotations are allowed, etc. What's wrong with normal pattern matching
and expression building with the standard AST? It might be a little bit more
verbose, but it's so much simpler to understand.

- A different syntax (the revised one). I understand the benefits of this new
syntax, but it seems kind of crazy to have a "low-level" tool implemented in
(and encouraging) a syntax different from the core system.


[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-05-29 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of May 22 to 29, 2012.

1) New release of tuareg mode
2) Commercial Users of Functional Programming 2012: Call for Presentations
3) odb.ml mailing list
4) Other Caml News


1) New release of tuareg mode

** Christophe Troestler announced:

I am pleased to announce a new release of Tuareg mode:

 

It is recommended that you use the new SMIE based code by putting at
the toplevel (and NOT in the tuareg mode hook as I stated previously)
of your .emacs file

 (setq tuareg-use-smie t)

Please report any problem to the mailing list "tuareg-mode":

  

2) Commercial Users of Functional Programming 2012: Call for Presentations
Archive: 

** Ashish Agarwal announced:

  COMMERCIAL USERS OF FUNCTIONAL PROGRAMMING 2012
 CUFP 2012
  
   CALL FOR PRESENTATIONS
Copenhagen, Denmark
 Sep 13-15
 Co-located with ICFP 2012
Sponsored by SIGPLAN
   Talk Proposal Submission Deadline 29 June 2012

The annual CUFP workshop is a place where people can see how others
are using functional programming to solve real world problems; where
practitioners meet and collaborate; where language designers and users
can share ideas about the future of their favorite language; and where
one can learn practical techniques and approaches for putting
functional programming to work.

Giving a CUFP Talk
==

If you have experience using functional languages in a practical
setting, we invite you to submit a proposal to give a talk at the
workshop. We're looking for two kinds of talks:

Experience reports are typically 25 minutes long, and aim to inform
participants about how functional programming plays out in real-world
applications, focusing especially on lessons learned and insights
gained. Experience reports don't need to be highly technical;
reflections on the commercial, management, or software engineering
aspects are, if anything, more important.

Technical talks are also 25 minutes long, and should focus on teaching
the audience something about a particular technique or methodology,
from the point of view of someone who has seen it play out in
practice. These talks could cover anything from techniques for
building functional concurrent applications, to managing dynamic
reconfigurations, to design recipes for using types effectively in
large-scale applications. While these talks will often be based on a
particular language, they should be accessible to a broad range of
programmers.

If you are interested in offering a talk, or nominating someone to do
so, send an e-mail to sperber(at)deinprogramm(dot)de or
avsm2(at)cl(dot)cam(dot)ac(dot)uk by 29 June 2012 with a short
description of what you'd like to talk about or what you think your
nominee should give a talk about. Such descriptions should be about
one page long.

There will be a short scribes report of the presentations and
discussions but not of the details of individual talks, as the meeting
is intended to be more a discussion forum than a technical
interchange. You do not need to submit a paper, just a proposal for
your talk!

Program Committee
=

   Mike Sperber (Active Group), co-chair
   Anil Madhavapeddy (University of Cambridge), co-chair
   Ashish Agarwal (New York University)
   Thomas Arts (QuviQ AB)
   Chris Houser (LonoCloud)
   Tomas Petricek (University of Cambridge)
   Heiko Seeberger (Typesafe)
   Stefan Wehr (factis research)
   Noel Welsh (untyped)

More information


For more information on CUFP, including videos of presentations from
previous years, take a look at the CUFP website at
. Note that presenters, like other attendees, will need
to register for the event. Presentations will be video taped and
presenters will be expected to sign an ACM copyright release
form. Acceptance and rejection letters will be sent out by July 16th.

Guidance on giving a great CUFP talk


Focus on the interesting bits: Think about what will distinguish your
talk, and what will engage the audience, and focus there. There are a
number of places to look for those interesting bits.

   Setting: FP is pretty well established in some areas, including
   formal verification, financial processing and server-side
   web-services. An unusual setting can be a source of interest. If
   you're deploying F

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-05-22 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of May 15 to 22, 2012.

1) Any library for reading/writing compressed files?
2) extunix 0.0.4, ocaml-mysql 1.1.1 and some more
3) Other Caml News


1) Any library for reading/writing compressed files?
Archive: 

** Francois Berenger asked and Richard Jones suggested:

> What's the gold standard in OCaml to read/write
> compressed files?
> 
> I found this: 
> 
> Wouldn't it be possible that the Marshall module
> had an option to allow compression of the marshalled
> values?
> Or is there a simple way to achieve this?

If it's for Unix, then just open a pipe to or from an external
compression filter, eg:

open Unix
open Printf

let () =
let output = "output.xz" in
let chan =
open_process_out (sprintf "xz --best > %s"
(Filename.quote output)) in
output_value chan 42;
let status = close_process_out chan in
(* some code here to check status was ok *)
()

(Also a good way to generate images from OCaml programs: pipe
to pnmto* programs).
  
** Adrien Nader also replied:

There are libarchive bindings by Sylvain Le Gall on the forge too.
They're partial but already work for reading iirc, and writing
shouldn't be a lot of work (if it hasn't been added since I last
looked at it). That will potentially give xz, gzip, bzip2, tar, cpio
and I don't know what else.


2) extunix 0.0.4, ocaml-mysql 1.1.1 and some more
Archive: 

** ygrek announced:

It is my pleasure to announce the multitude of (long overdue) releases 
tonight :

ocaml-extunix 0.0.4
---

ExtUnix provides thin bindings to various low-level system APIs which are 
not covered by Unix module.
This release adds many new bindings and implements bigarray variants of some 
functions (as a consequence
extunix now depends on bigarray). Many thanks to Goswin von Brederlow (who 
was the driving force behind this
release), Andre Nathan and all previous (and future) contributors.

Get it at 

ocaml-mysql 1.1.1
-

Bindings to libmysqlclient. This release update build infrastructure tools 
(OCamlMakefile, autotools, etc), provides
Windows build support (both for msvc and mingw), fixes OCaml 3.12 
compatibility and implements a couple of new features.
Thanks go to Dmitry Grebeniuk and Hezekiah M. Carty.

More info and download links : 

ocaml-geoip 0.0.1
-

Bindings to libGeoIP library to access offline database of geographical 
information keyed by IP address. The bindings code
is generated by camlidl and hopefully provides a comprehensive coverage of 
available C API.

Homepage : 

ocaml-lzo 0.0.1, ocaml-snappy 0.0.1 
---

Both these packages implement bindings to fast lossless 
compression/decompression libraries (that generally favor speed
over compression ratio) and feature simple interface that operates on string 
buffers.

Choose your poison :  or 


ocaml-winsvc 0.0.1
--

winsvc helps to turn OCaml program into Windows service. This is some old 
(but working) code with hardcoded build scripts.

Drags out miserable existence at 
  

3) 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 .

RegStab 2.0:
  

ocaml-winsvc 0.0.1:
  

ocaml-extunix 0.0.4 released:
  

ocaml-lzo 0.0.1 release:
  

OCaml Users and Developers conference 2012:
  

  

Old cwn


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

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-05-15 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of May 08 to 15, 2012.

1) camlp4 and generating class definitions
2) Barista 2.0-alpha3
3) OCaml Users and Developers (OUD)
4) 108.00-pre2 pre-release of Core suite
5) Any tool for unit tests as comments in OCaml source?
6) Other Caml News


1) camlp4 and generating class definitions
Archive: 

** Joel Reymont asked and Jacques Garrigue replied:

> I would like to auto-generate an object with a couple of mutable
> fields and some methods.
> 
> I would then like to pretty-print the code into a file.
> 
> Are there any examples showing how to do this with camlp4?

My syntax extension for properties does that.

I haven't tested it recently but hopefully it still works.
  
** Philippe Veber also replied:

You can have a look at Martin Jambon's col syntax extension :



Have a look at pa_col.ml, starting line 400.


2) Barista 2.0-alpha3
Archive: 

** Xavier Clerc announced:

This post announces the 2.0-alpha3 release of the Barista project, whose goal
is to provide a library for Java class file construction and a Java
[dis]assembler, released under the LGPLv3.
This new version fixes several critical bugs.

Home page: 
Forge page: 

Main changes since 2.0-alpha2:
  - support for '*.sym' and '*.war' files in classpath
  - 'JAVA_HOME' environment variable used to load JDK classes
  - '/usr/libexec/java_home' utility used to load JDK classes (MacOS X)
  - 'Predef' module renamed to 'Predefined'
  - peephole rule for optimization of load/load sequences
  - no automatic detection of 'ocamljava' binary
  - bug #99: wrong packing of int32 into int64
  - bug: ocamlbuild plugin for ocamljava-based compilation
  - bug: invalid stack maps when double/long is followed by top
  - bug: invalid locals size when over 255
  - bug: incorrect graph flattening when wide gotos are used
  - bug: install 'cmi' file
  

3) OCaml Users and Developers (OUD)
Archive: 

** Didier Remy announced:

Dear OCaml Users and Developers,

This is a reminder that this year "OCaml Meeting", renamed the "OCaml
Users and Developers workshop (OUD)", will be colocated with ICFP in
Copenhagen, Denmark on September 14th.

The deadline for submitting Talk Proposals is 8th June 2012,  only few
weeks away.  Visit  for all details.

Don't miss it!

Didier

  OCAML USERS AND DEVELOPERS WORKSHOP 2012
OUD 2012
  
 CALL FOR PRESENTATIONS
   Copenhagen, Denmark
   Fri, Sep 14th
  Co-located with ICFP 2012
Sponsored by SIGPLAN
Talk Proposal Submission Deadline 8th June 2012


In 2012, the OCaml Meeting will be renamed the OCaml Users and Developers
workshop (OUD), and be colocated with ICFP in Copenhagen, Denmark. It
will be held on Friday September 14, after the ML workshop (Thu 13)
and before the Commercial Users of Functional Programming (Sat 15).

The OCaml Users and Developers Workshop will bring together industrial
users of OCaml with academics and hackers who are working on extending the
language, type system and tools. Discussion will focus on the practical
aspects of OCaml programming and the nitty gritty of the tool-chain and
upcoming improvements and changes.  Thus, we aim to solicit talks on
all aspects related to improving the use or development of the language,
including, for example:

- compiler developments; new backends, runtime and architectures.
- practical type system improvements, such as (but not exhaustively) 
  GADTs, first-class modules, generic programming, or dependent types.
- new library or application releases, and their design rationales.
- tool enhancements by commercial consultants. 
- prominent industrial uses of OCaml, or deployments in unusual
  situations.

It will be an informal meeting, with an online scribe report of the
meeting, but no formal proceedings for this year. Slides of presentations
will be available online from the workshop homepage.

To submit a talk, please register an abstract or outline (1-2 pages) at


[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-05-08 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of May 01 to 08, 2012.

1) Summer School on Functional Programming for Parallel and Concurrent 
Applications
2) Uutf 0.9.0 and Jsonm 0.9.0
3) A shallow option type
4) extending user-defined polymorphic variant types
5) findlib-1.3.0
6) Other Caml News


1) Summer School on Functional Programming for Parallel and Concurrent 
Applications
Archive: 

** Francesco Zappa Nardelli announced:

[Even if the lectures focus on Haskell, this summer school might be of
interest to readers of the caml-list.]

I am happy to annouce the CEA-EDF-INRIA summer school on

 FUNCTIONAL PROGRAMMING
FOR PARALLEL AND CONCURRENT APPLICATIONS

11-22 June 2012, Castle of Cadarache, Saint Paul Lez Durance, France

 

Objectives

The aim of the summer school is to give a thorough and application-
oriented introduction to functional programming using the programming
language Haskell. A special focus is on parallel and concurrent
programming, highlighting the ways in which features such as strong
typing and purity make it dramatically easier to write reliable
parallel or concurrent code. The school is split into three different
courses that highlight different aspects of functional
programming. All courses consist of lectures and hands-on sessions
where everyone can try out the language on several exercises.

Public

This school is a 2 weeks course for engineers, and for students and
researchers. Participants should be familiar with programming (e.g. in
C or Java), but the school will be self-contained and no preliminary
knowledge of functional programing is required.

Speakers

Ralf Hinze (Oxford University)
Andres Löh (Well-Typed)
Simon Marlow (Microsoft Research)

Talks (to be confirmed)

Joe Armstrong, Mark Shinwell, Anil Madhavapeddy.

Registration and contact:

The deadline for registration is May 30, 2012.  Please contact:

Régis Vizet - CEA
regis.vizet (at) cea.fr
tel: 0033 1 69 26 47 45

for further informations.
  

2) Uutf 0.9.0 and Jsonm 0.9.0
Archive: 

** Daniel Bünzli announced:

I'd like to announce the following two modules. First Uutf:

 Uutf is a non-blocking streaming codec to decode and encode the UTF-8,
 UTF-16, UTF-16LE and UTF-16BE encoding schemes. It can efficiently
 work character by character without blocking on IO. Decoders perform 
 character position tracking and support newline normalization. 

 
 Functions are also provided to fold over the characters of UTF encoded
 OCaml string values and to directly encode characters in OCaml Buffer.t
 values.


 Uutf is made of a single, independent, module and distributed under
 the BSD3 license.

Project home page: 
API doc & examples: 

The aim of Uutf is to provide a convenient abstraction for
non-blocking streaming Unicode text processing and to implement
non-blocking LL(k) parsers over Unicode text. It's used by Jsonm and
will certainly be used by Xmlm in the future.

The second module is Jsonm:

 Jsonm is a non-blocking streaming codec to decode and encode the JSON
 data format. It can process JSON text without blocking on IO and
 without a complete in-memory representation of the data.


 The alternative "uncut" codec also processes whitespace and
 (non-standard) JSON with JavaScript comments.

 
 Jsonm is made of a single module and depends on [Uutf]. It is distributed 
 under the BSD3 license.

Project home page: 
API doc & examples: 

Basically Jsonm is to JSON what Xmlm is to XML. It's a rather
low-level approach where you work with streams of structural lexemes
which reflect the data model underlying the data language. The
sequence of lexemes is guaranteed to be presented to you according to
a simple grammar or errors are returned. This allows to
consume/produce the data without having the whole data in memory while
abstracting over the idiosyncrasies of the data language. I also hope
it can serve as basis to define efficient data query combinators.

Jsonm's design is however more convient than Xmlm's one: Jsonm has
precise lexeme position tracking support, best-effort decoding that
allows to continue after an error, trivial input termination condition
(just decode `End, whereas in Xmlm you have to count), and allows to
access whitespace to write data filters that preserve as much of the
original data as possible (P.S. I hope to event

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-05-01 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of April 24 to May 01, 2012.

1) llpp v12
2) Other Caml News


1) llpp v12
Archive: 

** malc announced:

New version of llpp (tagged v12) is no available at


Blurb:

llpp a graphical PDF viewer which aims to superficially resemble
less(1)

Changes:

* MuPDF[1]  had a 1.0 release.
* Split columns mode
* Hints mode a la conkeror[2] (handy for mouseless navigation)
* Made sure that things do run under Cygwin's X and XQuartz

[1] 
[2] 
  

2) 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 
<;.>

Hg repository on bitbucket:
  

Fun(c) with OCaml and Mazes:
  

The Haskell / Snap ecosystem is as productive (or more) than Ruby/Rails.:
  
  

Old cwn


If you happen to miss a CWN, you can send me a message
([email protected]) 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 at
 .




___
caml-news-weekly mailing list
[email protected]
http://lists.idyll.org/listinfo/caml-news-weekly


[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-04-24 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of April 17 to 24, 2012.

1) Build OCaml iOS apps under Lion
2) PEC ver. 1.1
3) ERic release v0.2
4) Boolean expression simplifier library
5) Kendall tau in OCaml
6) OCaml marine navigation iPad app
7) cocan.org
8) ODT 2.2 released
9) Other Caml News


1) Build OCaml iOS apps under Lion
Archive: 

** Jeffrey Scofield announced:

I've created a new version of OCamlXARM, which is my name for a version
of the OCaml compiler that builds executables for iOS.  The new version
(1.0.15) works with Lion (OS X 10.7) and the latest Xcode (4.3.2).

A while back there were some queries about using OCamlXARM on Lion, and
I promised to get it working after our latest iOS app was released.  So,
the 1.0.15 release is what I promised.

Instructions for downloading a binary release of OCamlXARM, or building
it from source, and for testing, are at:



You can read about what I had to do to get it working on
Lion in my sporadic blog:



There were problems reported in using the old OCamlXARM with Lion.  I
haven't seen any of these problems with the latest OCamlXARM.  I built
all my test apps, and also rebuilt the real-world iOS apps that we sell.
They all worked with no problems that I could find.  (In particular,
our real-world apps do plenty of floating arithmetic, and it works.)

Please let me know of any comments or problems.  I'd especially
like to hear about bugs in OCamlXARM (so I can fix them).
  

2) PEC ver. 1.1
Archive: 

** Satoshi Ogasawara announced, starting a long discussion on it vs React:

I'm please to announce release PEC version 1.1, a push-based event combinator 
library
which is helpful to write event driven systems with purely functional style.

 

PEC is similar to React library but there are some different points.

- PEC's update cycle is separated from sending events.
  You can send a value to event during update cycle.

- PEC doesn't hold any pointer(including weak one) to event until the
  event will be subscribed.

- All PEC's signal are switchable. 'switch' means you can replace dependency
  of a signal keeping signals depends on the signal unchanged.

You can see sample codes to use PEC.


  

3) ERic release v0.2
Archive: 

** Damien Guichard announced:

I'm please to announce release ERic version 0.2a, a small/simple (may be
simplistic ?) graph-based knowledge database.
The interface is command-line only.

SVN: 

Author:  Damien Guichard.
Last modification:   18-Apr-2012
Version: 0.2a
Licence: EUPL 1.1
Development status:  Stable
Kind:Application written in OCaml
Topic:   Databases
Homepage:   

  

4) Boolean expression simplifier library
Archive: 

** Markus W. Weißmann announced:

I'd like to announce the first public release of the 'boolean expression 
simplifier' library "bes".
It is an implementation of several algorithms for minimizing boolean 
expressions similar to the espresso solver [1] -- though in OCaml.
The source code is available on ocamlforge under the new bsd license:



It comes with a simple front-end program for reading and simplifying 
expressions in DFA from text files.
Students trying to verify their Karnaugh Veitch map solutions rejoice! ;)


Regards

-Markus

[1] 
  
** Francois Berenger asked and Markus W. Weißmann replied:

> I'm curious, what is it used for?
> 
> Is it for people doing proof checkers or things like this?

Like that, yes:
We successfully use it for reducing the size of programs we want to perform 
model checking on. My concrete target are industrial robot systems [1].

I even tried to integrate it into a compiler to reduce the size of 
right

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-04-17 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of April 10 to 17, 2012.

1) ocamlopen 1.0.2
2) post-doc position available at MSR-INRIA joint lab
3) PG'OCaml 1.5
4) New release of Interval Computation Library
5) Other Caml News


1) ocamlopen 1.0.2
Archive: 

** Leo P White announced:

If anyone is interested, I have written a new version of my patch to add open
extensible types to OCaml. It is available at:



The only new feature is allowing variant declarations to be made
extensible. This allows declarations like:

open type foo = A | B of int | ..

Having implemented it, I think that the extension might well be better off
without this feature, so I am also releasing another version of the patch
without it.

I have also written a much better example of how open types and GADTs might be
used. It basically shows how classes can be created that permit a kind of
nominative down-casting. I have included it below.

Finally, I have also added a feature request to Mantis if anyone would like to
comment.



Regards,

Leo



open type 'a class_name

exception Bad_cast

class type castable =
object
 method cast: 'a.'a class_name -> 'a
end

(* Lets create a castable class with a name*)

class type foo_t =
object
 inherit castable
 method foo: string
end

extend 'a class_name with Foo: foo_t class_name

class foo: foo_t =
object(self)
 method cast: type a. a class_name -> a =
   function
  Foo -> (self : #foo_t :> foo_t)
 | _ -> ((raise Bad_cast) : a)
 method foo = "foo"
end

(* Now we can create a subclass of foo *)

class type bar_t =
object
 inherit foo
 method bar: string
end

extend 'a class_name with Bar: bar_t class_name

class bar: bar_t =
object(self)
 inherit foo as super
 method cast: type a. a class_name -> a =
   function
   Bar -> (self : #bar_t :> bar_t)
 | other -> super#cast other
 method bar = "bar"
end

(* Now lets create a mutable list of castable objects *)

let clist :castable list ref = ref []

let push_castable (c: #castable) =
 clist := (c :> castable) :: !clist

let pop_castable () =
 match !clist with
 c :: rest ->
   clist := rest;
   c
   | [] -> raise Not_found;;

(* We can add foos and bars to this list, and retrive them *)

push_castable (new foo);;
push_castable (new bar);;
push_castable (new foo);;

let c1: castable = pop_castable ()
let c2: castable = pop_castable ()
let c3: castable = pop_castable ()

(* We can also downcast these values to foos and bars *)

let f1: foo = c1#cast Foo
let f2: foo = c2#cast Foo
let f3: foo = c3#cast Foo

let b2: bar = c2#cast Bar
  
** Gabriel Scherer asked and Leo P White replied:

> 1. You link to a paper by Andres Löh and Ralf Hinze, how close are you
> of their proposal?
> They mention open datatypes and functions, you propose open datatypes,
> but not open functions? That would be understandable because open
> pattern matching is a bit fishy (best-fit matching etc...).

I think that my open datatypes are basically the same as they propose, which
is pretty much the same as the behaviour of exn in OCaml.

> 2. What is the difference between your "open" and "extensible"
> datatypes? The visual difference is the present of initial
> constructors in extensible cases, but you apparently make much finer
> distinctions.

This complication arises from the existence "extensible variant declarations",
and is one of the reasons that I think the extension is probably better
without them.

Basically, by an "extensible" type I mean one for which not all the
constructors are given in the type declaration. Obviously all abstract types
in a signature are extensible, because they may be implemented using a variant
type. My extension allows variant type declarations to also be made extensible
using the syntax:

type Foo = A | B of int | ..

Note that this extensibility cannot be hidden by a signature, the compiler
needs to know if a variant is extensible in order to properly implement
pattern matching.

By an "open" type I mean one that is allowed to be extended using an extension
definition. Only extensible types can be declared open, becuase an extension
definition adds constructors to a type that are not mentioned in its
declaration. Unlike extensibility, the openness of a type can be hidden using
a signature.

> 3. What is the semantics of making a *constructor* private? My
> intuition of private types is that (type t = private u) generates a
> new type t that is a strict subtype of u (values of type t can be
> coerced into u, but not the other way around). This intuition does not
> hold anymore if some constructors are marked private, but not the
> other.

As Alain said, making a constructor

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-04-10 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of April 03 to 10, 2012.

1) New version of the binary installer for Windows
2) Non-blocking IO interface design


1) New version of the binary installer for Windows
Archive: 

** Continuing the thread from last week, Jonathan Protzenko said and Sylvain Le 
Gall replied:

> I've also looked into odb compatibility, and it looks like after writing 
> a few patches, odb now runs fine on Windows. However, Oasis-generated 
> setup.ml files do not work at all on windows. Any help in that area 
> would be highly appreciated.

This has nothing to do with windows. This is related the version number
of OCaml which is "4.01.0+dev0 (2012-03-12)". OASIS 0.2 doesn't handle
spaces in the version number... A more classical scheme for version
number with date is 4.01.0+dev0_2012-03-12. But anyway, this is fixed
since OASIS 0.2.1~alpha1 and will be automatically fix in any packages
hosted on the forge -- and it won't be there when your installer will
use a non dev version of OCaml.

BTW, the bug related to these issues is here:

I recommend to follow it.

>From what I have seen I am more concerned by the fact that the camlp4
findlib path contains strange char... There are some bugs in findlib on
Windows with pathname, I have attached a patch to the bug. Please test
and send it to Gerd Stolpmann.


2) Non-blocking IO interface design
Archive: 

** Daniel Bünzli said:

This is problematic : 





To solve this problem I'm looking for a simple interface design to
make my IO modules compatible with monadic concurrency libraries (lwt,
async, [insert your own here]) and event based loops (select(2),
poll(2), etc.). The design should have the following properties:

1. Unified interface for blocking and non-blocking mode. 
2. The existence of the non-blocking mode should not significantly
 impact blocking mode users.
3. Input possible from in_channel, string, refillable fixed-size string 
 buffer (non-blocking mode). 
4. Output possible to out_channel, Buffer.t, flushable fixed-size string
 buffer (non-blocking mode).
5. No third-party IO libraries/paradigms so that the module can adapt
 to the one the user chooses.
6. Reasonably efficient.

I looked for some time into Haskell's enumerators, pipes and other
conduits but I eventually came back to a more ad-hoc approach that
abstracts as follows. I'll gladly take any feedback you may have.

Suppose we want to IO streams of value of `type t`. For example xmlm's
signals (lexemes as they should be called) if you are familiar with
that.

For input (decoding) we begin with a type for input sources, decoders
and a function to create them.

type src = [ `Channel of in_channel | `String of string | `Manual ]
type decoder 
val decoder : src -> decoder

A [`Manual] source means that the client will provide the decoder with
chunks of bytes to decode at his own pace. The function for decoding
is :

val decode : decoder -> [ `Await | `End | `Error of e | `Yield of t ]

[decode d] is : 

- [`Await] iff [d] has a [`Manual] input source and awaits for
more input. The client must use [decode_src] (see below) to provide it.
- [`Yield v], if a value [v] of type [t] was decoded. 
- [`End], if the end of input was reached.
- [`Error e], if an error [e] occured. If you are interested in a
best-effort decoding, you can still continue to decode after
the error.

For [`Manual] sources the function [decode_src] is used to provide
the byte chunks to read from : 

val decode_src : decoder -> string -> int -> int -> unit

[decode_src d s k l] provides [d] with [l] bytes to read, starting at
[k] in [s]. This byte range is read by calls to [decode] with [d]
until `Await is returned. To signal the end of input call the function
with [l = 0].

That's all what is needed for input. Just a note on the `Error
case. Decoders should report any decoding errors with [`Error] to
allow standard compliant decodings. However at that point they should
give the opportunity to the client to continue to perform a best
effort decoding. In that case [decode] should always eventually return
[`End] even if [`Error]s were reported before. I think best-effort
decoding on errors is a good thing: I was annoyed more than once with
xmlm simply failing with `Malformed_char_stream on files produced by
legacy software that gave invalid UTF-8 encodin

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-04-03 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of March 27 to April 03, 2012.



1) Reducing boxing for floats
2) Ocsigen Eliom 2.1
3) New version of the binary installer for Windows
4) Other Caml News


1) Reducing boxing for floats
Archive: 

** Alain Frisch said:

I'd like to ask for the community help in evaluating the benefits of a new
strategy to control boxing/unboxing of floats in ocamlopt.

I've implemented this new strategy in the more_unboxing branch of the SVN. You
can find some description (and micro-benchmarks) there:




If numerical code is the bottleneck of one of your applications, it would be
helpful if you could you try out the more_unboxing branch (forked from the
trunk in january 2011, IIRC) and report the results on Mantis.
  
** Dario Teixeira then replied:

Thanks for this!  I've given the 'more_unboxing' branch a brief try, using
the N-body problem from the infamous shootout as benchmark.  Below are the
results for executables compiled with 3.12.1, today's SVN trunk, and today's
'more_unboxing' branch.  The compiler options are the same as used in the
shootout; the tests consisted of 10^9 iterations on an x86_64 machine:

Version 3.12.1:

 time ./nbody.native 1_000_000_000
 .23user 0.13system 18:32.61elapsed 99%CPU (0avgtext+0avgdata 
3472maxresident)k
 0inputs+0outputs (0major+273minor)pagefaults 0swaps

SVN trunk (2012/03/29):

 time ./nbody.native 1_000_000_000
 969.29user 0.62system 16:14.66elapsed 99%CPU (0avgtext+0avgdata 
3488maxresident)k
 0inputs+0outputs (0major+273minor)pagefaults 0swaps

SVN branches/more_unboxing (2012/03/29):

 time ./nbody.native 1_000_000_000
 960.72user 0.30system 16:03.51elapsed 99%CPU (0avgtext+0avgdata 
3472maxresident)k
 0inputs+0outputs (0major+272minor)pagefaults 0swaps

Though the improvement from trunk to more_unboxing is small (about 1%) and
may in fact disappear altogether if one were to run a serious statistical
analysis, the improvement from 3.12.1 to 4.00 is quite striking: about 13%!
What has changed in the compiler that would explain this?

Also, a note to those using GODI: it's fairly straightforward to have multiple
co-existing OCaml installations, making the test of trunk or experimental
branches less disrupting.  You'll find at the end the steps I used to get the
'more_unboxing' branch running.  (Note that I had to run each godi_make step
individually because of step 6, though I'm sure the GODI ninjas will find
ways to streamline this process even further.)

Best regards,
Dario Teixeira



1) Tell GODI the SVN location to checkout.
   Edit $GODI/etc/godi.conf:

  OCAML_SVN_CHECKOUT = yes
  OCAML_SVN_PATH = /ocaml/branches/more_unboxing

2) cd $GODI/build/godi/godi-ocaml-src

3) godi_make clean

4) godi_make fetch

5) godi_make extract

6) GODI expects the source code directory to be called 'work/ocaml'.
   So we must do some renaming before proceeding:

  mv -T work/more_unboxing work/ocaml

7) godi_make patch

8) godi_make configure

9) godi_make build

10) godi_delete godi-ocaml-src-3.12.1godi1

11) godi_make install

12) godi_make package

13) Start godi_console and mark package godi-ocaml for rebuilding.
This will automatically force an overall rebuild.

14) Enjoy! 


2) Ocsigen Eliom 2.1
Archive: 

** Vincent Balat announced:

We are happy to announce release 2.1 of Ocsigen Eliom.
 
With Eliom, you can implement client-server Web applications fully in
OCaml. Client parts, delimited by a syntax extension, are automatically
extracted from the application source code and compiled to _javascript_ using
the Js_of_ocaml compiler.
 
Eliom also provides very powerful tools to implement classical Web sites, and
makes it possible to mix usual Web interactions with advanced client side
features.
 
Links:
 
Main changes in this version: 
Eliom project's page: 
Ocsigen tutorial: 
The example of the tutorial: 
Ocsigen project: 
  

3) New version of the binary installer for Windows
Archive: 

** Jonathan Protzenko announced:

I've spent the past few days improving the OCaml installer for windows. This
shou

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-03-27 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of March 20 to 27, 2012.

1) Explicitely named type variable and type constraints
2) OCaml app for iOS, Schnapsen card game
3) Wanted: GADT examples: string length, counting module x
4) GADT examples: composable functions list
5) Js_of_ocaml version 1.1
6) Software engineer position at MyLife
7) Other Caml News


1) Explicitely named type variable and type constraints
Archive: 

** Philippe Veber asked and Jacques Garrigue replied:

> I found myself defining a type that would both contain a module type and a 
> type constraint:
> 
>   module type Screen = sig
> type state
> type message
> val init : state
> [...] 
>val emit : state -> message option
>   end
>   type 'a screen = (module Screen with type message = 'a) constraint 'a = 
> [> `quit]
> 
> That is supposed to express that screens emit messages, and that one of the 
> messages can be "quit". Now I've got some trouble when using the 'a screen 
> type in a function that unpack the module it contains:
> 
>   let f (screen : 'a screen) = 
> let module Screen = (val screen : Screen) in
> match Screen.(emit init) with
>   | Some `quit -> 1
>   | _ -> 0
> 
>   ;;
> Error: This expression has type
>  ([> `quit ] as 'a) screen = (module Screen with type message = 'a)
>but an expression was expected of type (module Screen)

Indeed, this is clearly wrong: these two module types are not equivalent.

> New attempt:
> 
> # let f (screen : 'a screen) = 
> let module Screen = (val screen : Screen with type message = 'a) in
> match Screen.(emit init) with
>   | Some `quit -> 1
>   | _ -> 0
>   
>   ;;
> Error: Unbound type parameter 'a

Wrong again, as subtyping between module signatures does not
allow free type variables.

> Though here I'm not sure the error is right. New attempt:
> 
> 
> # let f (type s) (screen : s screen) = 
> let module Screen = (val screen : Screen with type message = s) in
> match Screen.(emit init) with
>   | Some `quit -> 1
>   | _ -> 0
>   
>   ;;
> Error: This type s should be an instance of type [> `quit ]
> 
> Which makes sense. So here is my question: is there a way to impose a 
> constraint on the "newtype" introduced in argument? Let me say that I'm 
> aware I should write this more simply. For instance in the module type 
> Screen, emit could have type state -> [`quit | `message of message]. So my 
> question is only a matter of curiosity. Still, I'd be happy to know :o).

No, currently there is no way to do that.
One can only create locally abstract types, not locally private types.
In theory I see no problem doing that, but with the current approach this 
would require new syntax,
and be rather heavy.

  let f (type s = private [> `quit]) (screen : s screen) = ...

And to be fully general, recursion between those types should be allowed 
too...

As a side note, writing
type message = private [> unit]
makes the problem clearer.
And solves it in some cases:

module type Screen =
  sig
type state
type message = private [> `quit ]
val init : state
val emit : state -> message option
  end
# let f (module Screen : Screen) =
match Screen.(emit init) with
| Some `quit -> 1
| _ -> 0
  ;;
val f : (module Screen) -> int = 

(using 4.00, but you can also write with (val ...))
  

2) OCaml app for iOS, Schnapsen card game
Archive: 

** Jeffrey Scofield announced:

As more proof that you can write real-world iOS apps in OCaml, our little
outfit Psellos has just released a second OCaml app through the App Store.
It plays the classic card games Schnapsen and Sixty-Six.

You can find info about the app at our website:



We think using OCaml was a real advantage in building the game-playing
engine.  It also seemed a great fit for the animation subsystem that I
wrote to make the cards move (immutably).

Also, these are great card games.  One of our friends was inspired by
the app to start up a blog about Schnapsen (also on the website).

In addition to the two apps that we sell (for cheap), I've written 5
apps that show how to code for iOS in OCaml.  The sources for all 5 are
available at our website in the OCaml section
().  A few people have used these examples as
the basis for their own apps.

There's also info on how to cross compile to iOS and to the iOS
Simulator, how to build the cross compilers we're using, and how to use
OpenGL ES from OCaml.

Recently there was a question about updating

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-03-20 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of March 13 to 20, 2012.

1) CVE request: Hash DoS vulnerability (ocert-2011-003)
2) New version of standalone ocaml interval library + mpfr/mpfi preliminary 
bindings for ocaml
3) Arrays and private types
4) ML workshop 2012: call for presentations
5) Software Development Engineer at OCamlPro (Paris, France)
6) Spring release
7) Efficient scanning of large strings from files
8) Parsing cmi file
9) Other Caml News


1) CVE request: Hash DoS vulnerability (ocert-2011-003)
Archive: 

** Deep in this thread, Xavier Leroy replied to many people:

Gerd Stolpmann writes:
> The Random module is definitely not good enough (e.g. if you
> know when the program was started like for a cgi, and the cgi reveals
> information it should better not like the pid, the Random seed is made
> from less than 10 unpredictable bits, and on some systems even 0 bits).

Dario Teixeira adds:
> I think the problem may be in finding a good source of randomness
> that is common across all OSes.  In Unixland this problem has
> largely been solved: pretty much everyone supports /dev/random and
> /dev/urandom.  Windows does things differently, however.

David Allsopp adds:
> Does the source of randomness have to be common? The decision to use
> a random seed doesn't need to be limited by a problem getting a good
> cryptographically secure generator on a given OS - you'd simply
> document that the implementation on that particular OS doesn't seed
> with a good PRNG and await a patch from someone who may care in the
> future, but at least the philosophy behind the decision is correct!

We are also thinking of strengthening Random.self_init, for instance
by using /dev/urandom when available.  This said, for randomizing
hashtables or other data structures, we do *not* need a
cryptographically-strong PRNG: we're not generating an RSA key pair or
some other situation where cryptographic quality is required; we're
just making a mild DOS attack impractical.

(Obligatory advertisement: if you're in need of
cryptographically-strong random data,

is what you need.)
  

2) New version of standalone ocaml interval library + mpfr/mpfi preliminary 
bindings for ocaml
Archive: 

** Jean-Marc Alliot announced:

Everything is in the title.

Just go to :

  

3) Arrays and private types
Archive: 

** Pietro Abate asked and Gabriel Scherer replied:

> In my application I'm using arrays all over, and lately I've discovered a
> couple of bugs related to the fact that I was using the index of one array 
> to
> get the element of another array. Since both indexes are int the compiler 
> could
> not help me at all. Using private types it seems I can solve this problem
> without loosing anything (??).

Here is a proposal:
  


It works by using a functor to generate "fresh" private types for
keys. Note that the arrays themselves are still polymorphic (no
IntArray FloatArray etc.). The user still has to use the discipline to
produce a new application of ArrayMake each time she wants to use a
different kind of array: if she only does `module A = ArrayMake(struct
end)` and then use `A` for everything, there will be no additional
safety guarantee.
  
** Later on, Pietro Abate asked and Gabriel Scherer replied:

> Thanks Gabriel, very nice solution. If I go this way, I guess there is
> no way to access array elements using the usual a.(i) syntax (where i
> = M.key i)... [...]
> Is this a problem I can solve using a camlp4 decorator ?

I don't think you need -- nor want to use -- a camlp4 extension. a.(i)
is desugared into (Array.get a i) at a purely syntactical level in
OCaml, so you could overload its behavior by changing the Array module
in the typing environment.

With my example you could write, for example:
module A1 = ArrayMake(struct end)
let () =
  let module Array = A1 in
  let k = A1.key in
  assert (A1.make 3 true).(k 2);;

You could even define the ArrayMake functor so that it returns a
structure with an Array submodule. You would then write, using 3.12
"local open" syntax:

module A1 = ArrayMake(struct end)
let () =
  let open A1 in
  assert (Array.make 3 true).(k 2)

That said, I 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-03-13 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of March 06 to 13, 2012.

1) TypeRex release 1.0.0 candidate 1
2) OCaml Users and Developers workshop (OUD)
3) oasis packaging questions
4) A js_of_ocaml equivalent for the JVM?
5) Stog: static web site and blog generator
6) TypeRex 1.0.0
7) ocamldoc: Howto crossreference another library?
8) Other Caml News


1) TypeRex release 1.0.0 candidate 1
Archive: 

** Continuing the thread from last week, Stefano Zacchiroli asked and Tiphaine 
Turpin replied:

> At the same time, I'm not thrilled at the idea of having to use a
> different ocamlc just to benefit from TypeRex. Having to do so brings a
> number of disadvantages, the first and foremost being that now the
> programmer needs to worry about having synchronized versions of the
> "legacy" ocamlc installed on his machine and the version shipped by
> TypeRex.
First, a small precision (which may not be obvious from TypeRex 
documentation): as the ocp-ocamlc, ... commands are only wrappers, they 
are not tied to a particular version of the actual compilers they call. 
In fact the following three components are somehow independent:
- the installed OCaml compilers (currently only 3.12.* is supported, 
because by mistake we forgot to include 3.11 compatibility, will be 
fixed in 1.0.0)
- TypeRex (with ocp-type and ocp-ocamlc, etc.)
- the OCaml compiler used to compile TypeRex (since rc2, >=3.11 works)
However, TypeRex won't be able to handle new language constructs that 
are introduced in OCaml after we extract its front-end, which implies that:
- we will have too follow closely the language evolutions and we will 
release a new version of TypeRex for each major release of OCaml.
- using Typerex for developping the OCaml compiler prevents you to use 
the new language constructs that you introduce, until TypeRex is itself 
updated.
>   But there are more disadvantages, unfortunately.
>
> Can you tell us why we can't (or maybe *when* we will be able to :-))
> have the nice features offered by TypeRex on top of the stock ocamlc
> compiler?
We would like to have the binary annotation feature included in the next 
release of OCaml. Before proposing a patch upstream, we wanted to 
stabilize the changes in the compiler and prove them to be generic 
enough. But there are two alternatives to having binary annotations in 
OCaml:
- improve the ease of use of the wrappers (there have been interesting 
suggestions in this direction on the issue tracker)
- integrate with a build system (which would also replace the ad-hoc 
.typerex file)
  

2) OCaml Users and Developers workshop (OUD)
Archive: 

** Didier Remy announced:

  OCAML USERS AND DEVELOPERS WORKSHOP 2012
OUD 2012
  
 CALL FOR PRESENTATIONS
   Copenhagen, Denmark
   Fri, Sep 14th
  Co-located with ICFP 2012
Sponsored by SIGPLAN
Talk Proposal Submission Deadline 8th June 2012


In 2012, the OCaml Meeting will be renamed the OCaml Users and Developers
workshop (OUD), and be colocated with ICFP in Copenhagen, Denmark. It
will be held on Friday September 14, after the ML workshop (Thu 13)
and before the Commercial Users of Functional Programming (Sat 15).

The OCaml Users and Developers Workshop will bring together industrial
users of OCaml with academics and hackers who are working on extending the
language, type system and tools. Discussion will focus on the practical
aspects of OCaml programming and the nitty gritty of the tool-chain and
upcoming improvements and changes.  Thus, we aim to solicit talks on
all aspects related to improving the use or development of the language,
including, for example:

- compiler developments; new backends, runtime and architectures.
- practical type system improvements, such as (but not exhaustively)
  GADTs, first-class modules, generic programming, or dependent types.
- new library or application releases, and their design rationales.
- tool enhancements by commercial consultants.
- prominent industrial uses of OCaml, or deployments in unusual
  situations.

It will be an informal meeting, with an online scribe report of the
meeting, but no formal proceedings for this year. Slides of presentations
will be available online from the workshop homepage.

To submit a talk, please register an abstract or outline (1-2 pages) at
 with as much information as you feel will
support the propos

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-03-06 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of February 28 to March 06, 
2012.

1) Release - A multi-process daemon framework
2) OCamlnet-3.5.1
3) Camlp5 6.04 - configurable name
4) TypeRex release 1.0.0 candidate 2
5) application scope for hashtable on weak pointers
6) [community poll for PR#5312] Do some OCaml Windows users still use the 
@responsefile feature?
7) Commercial Users of Functional Programming 2012: Call for Presentations
8) Other Caml News


1) Release - A multi-process daemon framework
Archive: 

** Andre Nathan announced:

I've just created the Release repository on Github:

  

>From the README:

  Release is a multi-process Lwt-enabled daemon framework for
  OCaml, providing facilities for type-safe inter-process
  communication and privilege-dropping.

  Its goal is to make it easy to write servers that are
  released from the calling terminal and to release root
  privileges when those are not necessary.

This is not yet a stable release and I'm still working on some features,
but any feedback would be much appreciated.
  

2) OCamlnet-3.5.1
Archive: 

** Gerd Stolpmann released:

There is a patch release available, 3.5.1, fixing a few errors, mostly
build-related:

- Missing symbols on FreeBSD-9
- Missing symbols on Debian Wheezy (probably because of stricter 
  linking)
- posix_spawn is disabled on Mac (for the time being until the problem
  can be further tracked down)
- Mac OS does not like fchmod on shared memory
  

3) Camlp5 6.04 - configurable name
Archive: 

** Daniel de Rauglaudre announced:

New release of Camlp5 (6.04) where:

The *names* of all what are built (executables, library) are now
configurable, allowing to have 'strict' and 'transitional' modes
both installed in the same computer in different places.

Example:
./configure --strict
make world.opt
make install
./configure --transitional name=camlp5t
make world.opt
make install

In that case, executables in transitional mode are camlp5t, camlp5to,
camlp5tr and so on... and the library is installed in a directory
named camlp5t instead of camlp5. No conflict between the two modes.

Download at:
  
  

4) TypeRex release 1.0.0 candidate 2
Archive: 

** Tiphaine Turpin announced:

This is time for a second release candidate for TypeRex, our new
OCaml development environment for Emacs. We want to thank the many early
adopters, for their useful feedback and encouraging comments.

The new version is available on TypeRex website at:



It fixes a number of issues, here is the list of changes:

- Improved performance on large libraries (lazy environments, more cache)
- Fixed encoding bug with 3bytes utf8 characters
- Use line/column positions instead of absolute bytes (fixes windows eol)
- More robust ml/mli switching (contributed by Wojciech Meyer)
- Fixed camlp4 first-class modules
- Compiles with 3.11.2 as claimed (no more 3.12 syntax in the code)
- Made the prefix key customizable (C-o by default)
- Added option --disable-version-check to configure script
- Source extensions customizable (e.g., .eliom), mlp included by default
- Allow to disable syntax coloring completely
- Applied Jun Furuse's indentation patch and changed a few defaults
- Use the caml-mode error regexp instead of tuareg's
- Fixed coloring of constructors in type definitions
- Fixed the crash when starting emacs on several files (>=3)
- Fixed wrapper for -a
- Less risky names in lisp code
- Slightly improved documentation (ocamlbuild, libraries, module packing)
- Tuareg actions use TypeRex stdlib path instead of hard-coded default


Summary of TypeRex features:

* Improved syntax coloring
* Auto-completion of identifiers (experimental)
* Browsing of identifiers: show type and comment, go to definition,
  cycle between alternate definitions, and semantic grep;
* Strictly semantic-preserving, local and whole-program refactoring:
  o renaming identifiers and compilation units
  o open elimination and reference simplification
* Robust /w.

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-02-28 Thread Alan Schmitt

Hello,

Here is the latest Caml Weekly News, for the week of February 21 to 28, 
2012.


1) TypeRex release 1.0.0 candidate 1
2) Ocamlnet-3.5
3) findlib-1.2.8
4) post-doc position available at MSR-INRIA joint lab
5) llpp v11
6) Other Caml News


1) TypeRex release 1.0.0 candidate 1
Archive: 



** Tiphaine Turpin announced:

We are pleased to announce the first release candidate of TypeRex, a new
OCaml development environment, developed by OCamlPro and Inria Saclay.
This version of TypeRex only integrates with Emacs and brings a
collection of new features that programmers expect from a modern IDE.
Next versions will target more editors.

Downloads, screenshots, documentation, support and feedback
instructions are available on TypeRex website at:



Summary of TypeRex features:

* Improved syntax coloring
* Auto-completion of identifiers (experimental)
* Browsing of identifiers: show type and comment, go to definition,
  cycle between alternate definitions, and semantic grep;
* Strictly semantic-preserving, local and whole-program 
refactoring:

  o renaming identifiers and compilation units
  o open elimination and reference simplification
* Robust /w.r.t./ not-recompiled, possibly unsaved buffers
* Scalable (used regularly on a few hundreds of source files)

Auto-completion is disabled by default, since more testing is still
needed for this feature.

TypeRex is written in OCaml, communicating through a socket with the
OCaml mode of the editor (currently Tuareg for Emacs, OCAIDE for Eclipse
soon).

All the features of the Tuareg mode are also included, even when we
provide an equivalent for them.


2) Ocamlnet-3.5
Archive: 



** Gerd Stolpmann announced:

it is time for another version of Ocamlnet. The new release 3.5 focuses 
on

the system interface, and includes a long list of smaller improvements.

The system interface, Netsys_posix, is extended by:
 - Support for POSIX clocks and POSIX timers (with nanosecond 
resolution)
 - Netsys_posix.spawn usses now the posix_spawn call if present on the 
OS

 - Adding support for pollable events (as e.g. provided by Linux via
   eventfd). For other OS an emulation is available.
 - Support for epoll on Linux

Note that Netsys_posix covers now large parts of POSIX realtime.

Other improvements:

 - The code generator for XDR has been improved. A new switch -direct 
for
   ocamlrpcgen can be used to generate direct mappings between OCaml 
values

   and binary representation (in many cases). Speedups up to 50% are
   possible for large XDR values.
 - The new module Uq_mt allows it to access an event-driven resource 
from

   several kernel threads (e.g. use an RPC client commonly from several
   threads).
 - The thread-safety of Netplex container functions has been improved.
 - Netmulticore condition variables can now be polled, for better
   integration into event-based programs.
 - Option greedy_accepts for Netplex to support servers that accept
   many connections per second. With this improvement, Netplex can
   now accept more than 5000 connections/s, and assign them to worker
   processes.

Last but not least there is now a new tutorial for Equeue (event systems
and engines). In particular, the section about combining Ocamlnet with 
Lwt

might be interesting.

For the full list of changes (especially bug fixes), see:



The download, manual, and other resources:



GODI has been updated.


3) findlib-1.2.8
Archive: 



** Gerd Stolpmann announced:

Findlib-1.2.8, a patch release, is out. It includes a fix for Win32, and
support for "ocamlfind ocamlmklib", mostly for completeness.




4) post-doc position available at MSR-INRIA joint lab
Archive: 



** Damien Doligez announced:

Research team: Tools for Proofs, MSR-INRIA Joint Centre
===

The Microsoft Research-INRIA Joint Centre is offering a 2-year
position for a post-doctoral researc

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-02-21 Thread Alan Schmitt

Hello,

Here is the latest Caml Weekly News, for the week of February 14 to 21, 
2012.


1) interval trees
2) browsing the code while reading the doc
3) Some utilities about camlp4
4) Other Caml News


1) interval trees
Archive: 



** Continuing the thread from last week, Francois Berenger announced:

I did a naive implementation of interval trees for float intervals.

It is available here:



2) browsing the code while reading the doc
Archive: 



** Francois Berenger asked and bluestorm replied:


It would be really cool when while looking at the HTML doc
it would be possible to click somewhere so that the implementation
code unrolls under the doc text.

Because sometimes the text is not explicit enough,
some other times there is no text.

Hoogle has such feature and it was pretty useful when
I was coding in Haskell (maybe especially useful
because I was a beginner in that language), for example:



Just click on map to have a look at the corresponding implementation.


We delegate documentation production to the standard ocamldoc tool,
which doesn't have this feature, so that is not really in the game
zone of batteries developers. That said, it *could* be possible to
make that feature available without changing ocamldoc upstream, by
implementing it as a custom documentation formatter -- ocamldoc has a
flexible architecture in this regard.
  

Xavier Clerc has some experience tuning ocamldoc (
 ;), maybe he could comment on the feasibility of
this. You could ask on the caml-list, maybe cc-ing him. If you wished
to have a try at it directly, looking at how Argot is implemented
would be a good source of inspiration.

(There used to be a custom documentation generator for Batteries, but
afaik. we mostly ditched it because, while it was nice, it made
documentation generation time impossibly slow...)

** Maxence Guesdon suggested:

If you provide the .ml files to ocamldoc and use the -keep-code option,
generated html pages will give a link on each value to display the
corresponding code.

Another solution would be to adapt the odoc_literate custom generator 
you

can find here:
  
This generator provide an expand/collpase button for each value, useful 
when

writing doc in a literate programming way.

At last, since Dynlink now allows loading native code, ocamldoc now
supports loading custom generators compiled to native code, which may be
fast enough to use the batteries legacy generator.

** Gerd Stolpmann also suggested:

Before you start writing a total new custom formatter (which probably
breaks with every major OCaml version because of new syntactic 
elements),

consider to extend/override the standard formatter. I did that quite
successfully for the PXP documentation. The derived formatter is here:



(Note that for current OCaml you need to remove the "{" from the matched
strings in html_of_custom_text.)

When I developed this, I found the documentation in the OCaml manual as
insufficient. You really need to dive into the sources of ocamldoc,
especially odoc_html.ml (which is lengthy but easy to get). I guess for
the effect you want you have to override
create_fully_qualified_{module_}idents_links. The location of a 
definition

in the source code seems to be in deed available, in the m_loc.loc_impl
values that are stored with the records for the various syntactic
elements. Don't know whether it is easy to do, though.


3) Some utilities about camlp4
Archive: 



** bob zhang announced:

  the meta filter distributed with camlp4 is buggy and unmodular, I
put a modular one here
  

 building with syntax extension is really easy provided this file
  
It works with .inferred.mli, .pp.ml as well

** Gabriel Scherer asked and Hongbo Zhang replied:


I had trouble being sure what "meta filter" you were talking about.
Here's what I found out, in case other people on the list wondered the
same: the "meta" part of Camlp4 is about turning a value into a piece
of OCaml AST representing the syntax of thi

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-02-14 Thread Alan Schmitt

Hello,

Here is the latest Caml Weekly News, for the week of February 07 to 14, 
2012.


1) Vim plugin
2) llpp v10
3) OCaml/MinGW
4) interval trees
5) Package installation assumptions made by odb
6) Interval programming library
7) Other Caml News


1) Vim plugin
Archive: 



** Continuing the thread from last week, Pierre Vittet announced:

I have made a minor update of the plugin: When we print the type using
t, the type is also copied in the unnamed register. This 
allows

to copy it easily.




2) llpp v10
Archive: 



** malc announced:

New version of llpp is now available (tagged v10) at
 ;

Blurb:

llpp a graphical PDF viewer which aims to superficially resemble
less(1)

Changes (relative to v7, last version being announced here):

* MuPDF grown itslef XPS and CBZ support
* Margin trimming
* Multi column mode
* Probably more, since:

llpp$ git diff --stat v7..v10 | tail -1
 11 files changed, 5206 insertions(+), 2514 deletions(-)

How to build/run: 


3) OCaml/MinGW
Archive: 



** malc announced:

GCC shipped with (current) MingW no longer recognizes -mno-cygwin
argument, my oline searches for a workaround were fruitless, but
turns out there is one, one can create a self specs file and
make gcc (the driver) strip -mno-cygwin from cc1 invokation. This
can be done by putting a file named "specs" into a directory listed
under "install:" in the output of `gcc -print-search-dirs' containing
following line:
*cc1: %Archive: 



** Francois Berenger asked and Richard Jones replied:


I need to use an interval tree.

Biocaml has one, batteries have imap/iset, nice!

However, I have intervals of reals, not integers. :(

I want to build the tree (once), then query it with a real number
(many times) like in: which intervals contain the query real number?

Should I convert my floats to ints (by sorting them then ranking) 
before

inserting them into some existing interval tree for integers?
I am not so concerned about the pre-processing time.

Should I write from scratch?


I wrote a segment tree (integers, not floats), which is similar.  It
wasn't very hard.  The code is here if it helps:



** Goswin von Brederlow asked, Eliot Handelman replied and Sebastien 
Ferre added:


>  Anyone have something like this but for non-overlapping intervals 
and
>  allowing interval insertion and removal with merging and spliting 
of the

>  internaly used intervals?
>  >  Cis from Sébastien Ferré?
>  >  


The Cis library (Cis for Compact Integer Sets) is
designed for representing sets of integers, but it
could easily be adapted to the insertion and
removal of intervals since it already handles
the merging and spliting og intervals.

** Edgar Friendly also replied and Philippe Veber said:

Yes, IMap / ISet (borrowed from camomile and improved) do this.  I 
assume

biocaml's is the same.


Actually no, biocaml_intervalTree keeps the inserted intervals 
untouched, it

is in fact pretty similar to an interval multimap, with some specialized
operations. In cases when we want to describe a set of integers (vs a 
set of

intervals), we use ISet from Batteries. With these two structures we can
describe an interesting range of genome annotations.


5) Package installation assumptions made by odb
Archive: 



** Edgar Friendly said:

odb is a simple ocaml program to install ocaml packages with
dependencies. I've written a document on the assumptions it makes of the
packages it's to install. By sharing this, I hope to influence library 
and

application developers to use a standard interface for compiling their
program.

The details are here: 



Thank you for any feedback. Please bear in mind that odb is meant to be
simple, so the complexity of configuring, 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-02-07 Thread Alan Schmitt

Hello,

Here is the latest Caml Weekly News, for the week of January 31 to 
February 07, 2012.


1) Plasma-0.6 (Map/Reduce & distributed filesystem)
2) New ARM backend merged into trunk
3) llpp video
4) Other Caml News


1) Plasma-0.6 (Map/Reduce & distributed filesystem)
Archive: 



** Gerd Stolpmann announced:

I've just released Plasma-0.6, a major update of Plasma with numerous
changes. The most important:

 * For checking map/reduce out, there is now a mode that works without
   distributed filesystem, and that does not require any deployment.
   The files are just stored in the normal filesystem. Of course, the
   job can then only run on a single computer, but at least it can
   take advantage of multiple cores.

 * Added the Mapred_toolkit layer. This layer allows purely functional
   map/reduce programs. Running a job is only a matter of calling
   a function like

   val mapl_sort_fold :
mapl:(mapred_info -> 'a -> 'b list) rfun ->
hash:(mapred_info -> 'b -> int) rfun ->
cmp:(mapred_info -> 'b -> 'b -> int) rfun ->
initfold:(mapred_info -> int -> 'c) rfun ->
fold:(mapred_info -> 'c -> 'b -> 'c * 'd list) rfun ->
?finfold:(mapred_info -> 'c -> 'd list) rfun ->
partition_of:(mapred_info -> 'b -> int) rfun ->
?initcombine:(mapred_info -> 'e) rfun ->
?combine:(mapred_info -> 'e -> 'b -> 'e * 'b list) rfun ->
?fincombine:(mapred_info -> 'e -> 'b list) rfun ->
'a Place.t ->
'd Place.t ->
config ->
'b Place.codec ->
  ('d,[`W]) Seq.seq list result

 * Support for binary file formats

 * The sorting criterion can now be freely defined

 * Support for combiners

 * Map-only jobs are now possible

 * The RPC channels for controlling the job execution are now also
   privacy-protected. Plasma can now be run in a highly secure mode,
   where all network traffic is authenticated, encrypted and integrity-
   protected.

 * Support for counters

 * Enormous performance improvements

 * A number of bug fixes and improvements of the robustness

 * Last but not least, there is now a lot more documentation including
   a quickstart guide, the toolkit howto, various session
   transcripts.


General information about Plasma:

Plasma consists now of three parts, namely PlasmaFS, PlasmaKV, and 
Plasma

Map/Reduce:

  * PlasmaFS is a distributed replicating filesystem. Unlike other
such filesystems, it is transactional and exhibits transactions
to the user. Also, it implements almost all of what is known as
POSIX semantics, and it is mountable.
  * PlasmaKV is a key/value database on top of PlasmaFS. It is
designed for ultra-high read workloads, and offers interesting
properties borrowed from PlasmaFS (e.g. replication and ACID
transactions).
  * Plasma Map/reduce implements a variant of the popular
data processing scheme.

All pieces of software are bundled together in one download. The
project page with further links is



There is now also a homepage at



THIS IS NOW A BETA RELEASE! I'm searching for testers. Whoever has
access to a cluster please check Plasma out!

Plasma is installable via GODI for Ocaml 3.12.

For discussions on specifics of Plasma there is a separate mailing list:




2) New ARM backend merged into trunk
Archive: 



** Benedikt Meurer announced:

I just merged the latest patch for my new ARM backend into trunk 
(revision

12124). Compared to the old ARM backend, the new one does the following:

- Support for both software and hardware floating-point (VFPv3).
- Properly supports interworking with Thumb/Thumb-2 code for both OCaml 
and C

code.
- Supports dynamic linking and large memory models (PR#5049).
- Optional support for position-independent code via a command line 
option

-fPIC. This is disabled by default and not required for natdynlink.
- Can emit both ARM and Thumb-2 code, with avg. code size savings of 28% 
for

Thumb-2 (quite close the optimal 30% advertised by ARM Ltd.).
- Supports both AAPCS (armel) as well as extended VFP calling 
conventions

(armhf).
- Supports several special ARM instructions to reduce code size and 
latency.

- Uses standard ARM EABI runtime functions instead of relying on GCC
internals.
- Supports exception backtraces.
- Supports profiling using gprof.

It'd be great to get some early feedback / testing (esp. with the 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-01-31 Thread Alan Schmitt

Hello,

Here is the latest Caml Weekly News, for the week of January 24 to 31, 
2012.


1) SQL engine in OCaml with client side cache
2) Vim plugin
3) Other Caml News


1) SQL engine in OCaml with client side cache
Archive: 



** Deep in this thread, Diego Olivier Fernandez said and Pons Gabriel 
Scherer replied:



You don't seem to like SQL much, which is surprising as it is kind of
isomorphic to comprehension of sets (of tuples). That's why F# added
first class SQL support with comprehension-like syntax



This may be a little off-topic (but who cares at this point?), but
I'll take the chance to do some self-advertising here.
We (Jerôme Vouillon and I) have done something related a few years
ago: Macaque, a DSL for writing typed and composable SQL queries in
OCaml, in a comprehension syntax.
  
  

The comparison is that we also have something capable of typing SQL
queries as parts of OCaml programs. It more or less stops here, this
project is much less mature than the excellent LINQ work: it's mostly
a research prototype (with a very short development time: three
months) that hasn't been put to real use, mostly by lack of interested
users; it's understandable that the interest of the approach doesn't
compensate the cost of using a small, feature-restricted and
relatively arcane library when we have relatively solid SQL bindings.
By limitation of the implementation, it only supports PostgreSQL
(through the excellent PG'OCaml project, a pure-ocaml reimplementation
of the pgsql client protocol), and in retrospect the decision to use a
comprehension syntax instead of the real SQL syntax (that can be typed
all the same) is a bit unfortunate. But you may still be interested,
for example as inspiration if you decide to write some database stuff
in OCaml -- or, why not, as a user-developer.
  

For other SQL stuff in OCaml, see the Sqlite3 bindings, and possible
the "ocaml-orm-sqlite" project on top of it (whose approach is to use
code generation rather than a query DSL or combinator library; less
flexible, but result in simpler interfaces):
  
  


2) Vim plugin
Archive: 



** Pierre Vittet announced:

I don't know if many of you use Vim to write OCaml code. I had to make 
some
change on the official plugin in order to use the annotation as I 
wanted. I

share my modifications in the hope that they can be useful to others :
.

I corrected 2 bugs and add a functionnality allowing to use annotations 
on

every .ml file opened in the editor. Until now, it looks like previously
annotation were working only on the first opened OCaml file.

I use my modified version without any problem for several weeks. If you 
try my

plugin, please, keep me informed of the eventual bugs.


3) 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 
.


New js_of_ocaml example: Hyperbolic tree viewer:
  

Sessions: handling state, communication & concurrency in Opa.:
  



libsndfile-ocaml 0.8 available:
  

Zermelo Proof Checker 1.0:
  

libsndfile:
  


Old cwn


If you happen to miss a CWN, you can send me a message
([email protected]) 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 at
 .



___
caml-news-weekly mailing list

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-01-24 Thread Alan Schmitt

Hello,

Here is the latest Caml Weekly News, for the week of January 17 to 24, 
2012.


1) otags reloaded 3.12.1 for OCaml 3.12.1
2) ounit v1.1.1: Unit testing framework
3) polymorphic variants in match statements
4) Other Caml News


1) otags reloaded 3.12.1 for OCaml 3.12.1
Archive: 



** Hendrik Tews announced:

better late than never: I would like to announce the first
release of otags reloaded for OCaml 3.12. It is available at



Otags reloaded generates tags tables for emacs and vi/vim.

Note that otags (by default) refuses to compile with OCaml
3.12.0, because that version contains a bug that makes otags
quite unusable.

Otags reloaded is distributed under GPL v3.


2) ounit v1.1.1: Unit testing framework
Archive: 



** Sylvain Le Gall announced:

OUnit is a unit testing framework for OCaml, inspired by the JUnit tool 
for

Java, and the HUnit tool for Haskell.

More information on [HUnit]()

In version 1.1.1:

- bracket now enforce returning unit
- update examples
- ListSimpleMake now use the provided comparator for all elements

This version is already available on oasis-db (and can be installed 
through

odb):


Homepage:


Get source code:
$ darcs get 

Browse source code:



3) polymorphic variants in match statements
Archive: 



** Milan Stanojevi? asked and Jacques Garrigue replied:


Hi, we're trying to understand the type inference with polymorphic
variants in match statements. This is a simplification of an actual
case that happened in practice.

1)
let f i a =
match i, a with
| true, `A -> `B
| false, x -> x

fails with
File "foo.ml", line 4, characters 16-17:
Error: This expression has type [< `A ]
but an expression was expected of type [> `B ]
The first variant type does not allow tag(s) `B

2) changing false to _
let f i a =
match i, a with
| true, `A -> `B
| _, x -> x

this succeeds with
val f : bool -> ([> `A | `B ] as 'a) -> 'a

3) changing x in (1) to _ , and using a on the right side
let f i a =
match i, a with
| true, `A -> `B
| false, _ -> a

this fails in the same way as (1)

4) finally adding another case to match statement
let f i a =
match i, a with
| true, `A -> `B
| false, x -> x
| true, x -> x

this succeeds with the same type as (2)


So it seems there is some interaction between type inference and
exhaustivnest of the match statements.

Can someone shed some light on what is going on here?


Indeed. The basic idea is to close variant types when leaving them
open would make the pattern matching non-exhaustive.
Here, if we assume that a has type [`A | `B], then the pattern-matching
becomes non-exhaustive, so the type inferred is just [`A]
(i.e. the list of all constructors appearing inside the patterns at this
position).

Actually, the theory is a bit more complicated, and the full details are
in the following paper, but you should just expect the above behavior
in practice.

Typing deep pattern-matching in presence of polymorphic 
variants.



Note that there is also another way to make (1) type, without adding
new cases

  let f i a =
match i, a with
| true, `A -> `B
| false, (`A as x) -> x;;
  val f : bool -> [< `A ] -> [> `A | `B ] = 

Here we have removed the connection between a and the output,
allowing `A to be combine with `B without changing the type of a.


4) 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 
.


libsndfile:
  

OCaml Submodule Pattern:
  

OUnit 1.1.1:
  

Otags 3.12.1:
  

A puzzle about typing:
  

Happy ne

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-01-17 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of January 10 to 17, 2012.

1) References and polymorphism
2) The OCaml hump and RDF
3) ODT 2.1 released
4) Hello & F# Applied Research Jobs at MSR Cambridge
5) Building on Windows
6) Other Caml News


1) References and polymorphism
Archive: 

** Deep in this thread, Gabriel Scherer said:

For a description of how the value restriction is relaxed in the OCaml
type system, see the article
  "Relaxing the value restriction", by Jacques Garrigue, 2004
  
  

2) The OCaml hump and RDF
Archive: 

** Maxence Guesdon announced:

In order to test OCaml-rdf[1], I exported the OCaml Hump data as an RDF
graph. The data is available in three formats:
  XML: 
  turtle: 
  ntriples: 

The vocabulary used is here (and I hope it is correct):
   

If some of you find this information useful, let me know so that such a
dump can be created every night.

I'm a beginner regarding all these semantic web formats, so do not hesitate
to tell me if I'm doing something wrong.

[1] 
  

3) ODT 2.1 released
Archive: 

** Emmanuel Dieul announced:

This mail announces the new release of ODT: 2.1. 
ODT (OCaml Development Tools) is an Eclipse plug-in for OCaml.

More information on this release is available at 
.

Don't hesitate to try ODT, even for fun. ODT can be installed as explained
into the install notes (). 
A tutorial and several screenshots are available on the ODT website.

Thanks a lot for using ODT.
  

4) Hello & F# Applied Research Jobs at MSR Cambridge
Archive: 

** Don Syme announced:

First, a friendly hello from the F# group at Microsoft.
 
We have positions open at Microsoft Research in Cambridge, UK, which may be of
interest for those following ML-related languages. We would welcome
applications from people with a background in OCaml and applied research
topics. Please pass this on to anyone else who you think may be interested
 

 
Many thanks and best wishes
Don Syme
 
Come and work with the F# group at Microsoft Research in Cambridge!

Microsoft Research in Cambridge has open positions for very high quality
applicants with advanced computer science skills (normally recent PhD-level
graduates or highly relevant industry experience), and internships for current
PhD candidates or other talented masters students.

I would like to encourage potential candidates interested in any topic related 
to 
- F# itself, as a language and tool set
- Topics on the boundary of F# and its applications (for example, GPGPU
  programming with F#, variations on Hadoop programming with F# or other
  parallel/advanced programming)
- Variations on "Information rich programming" with F# and massively rich
  information sources, including other variations on meta-programming and
  compiler extensibility

A particular growing interest area for pulling advanced F# experimental work
together is in the field of web-delivered, data-rich cloud programming. Think
of taking some of the world's greatest applied programming language work,
delivering it to high quality in educative web-delivered learning
environments, combine it with innovative techniques for strong typing and
information-rich programming, combine with the wealth of rich information
sources that make the modern web, integrate with modern backend execution
environments, strategies, machine-learning tools and products, both
homogeneous and heterogeneous, and deliver it into the hands of real users.

Often postdoc and intern positions at MSR have a 100%
theory/research/publication focus. However, in this case we are explicitly
interested in candidates who would like to pursue a combined practice &
research agen

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-01-10 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of January 03 to 10, 2012.

1) On packaging
2) Understanding usage by the runtime
3) Core (and associated libraries) on bitbucket!
4) ocamlbrew
5) Camomile 0.8.4
6) mlvalues.py
7) Camlp5 new rel 6.03 -> compat with OCaml trunk
8) OCamlSpotter 1.4.0 for OCaml 3.12.1
9) Other Caml News


1) On packaging
Archive: 

** Deep in this thread, Edgar Friendly said:

I have, and the result is odb[1]. It backends with oasis-db[2], meaning if you
upload your oasis package, it will be installable via odb, including
deps. After finding out about barbra[3], a similar project with a different
starting point, I stole many of their good ideas, and now have support for a
local `packages` file that provides metadata for packages not available
through oasis-db. This packages file allows installation of packages available
from arbitrary URLs (anything curl-able), git, svn, cvs, hg, darcs, as well as
local directories.

For a large number of package examples (plus non-examples of packages that
fail to auto-install through make/omake/oasis), look here:


Contributions of additional packages welcome, fixes to the programs that don't
auto-install (See the bottom half of the packages file) are doubly welcome.

E.

[1] 
[2]  and

[3] still in stealth mode, maybe I shouldn't have stolen their thunder by
mentioning them
  

2) Understanding usage by the runtime
Archive: 

** Deep in this thread, Richard Jones said and Damien Doligez added:

> Is compaction disabled?  lablgtk disables it unconditionally by
> setting the global Gc max_overhead (see also the Gc documentation):
> 
>  src/gtkMain.ml:
>let () = Gc.set {(Gc.get()) with Gc.max_overhead = 100}

Anyone who disables compaction should seriously consider switching
to the first-fit allocation policy:

  let () = Gc.set {(Gc.get ()) with Gc.allocation_policy = 1}

This may slow down allocations a bit, but the theory tells us that
it completely prevents unbounded fragmentation of the OCaml heap.
  

3) Core (and associated libraries) on bitbucket!
Archive: 

** Yaron Minsky announced:

For those who are interested in getting a look at a development version of the
next release of the Core suite of OCaml libraries, Core is now hosted on
bitbucket.

   

We're still working on making installation smoother and easier, as well as
solving portability problems.  But please take a look.  There's also a
discussion list:

   

This represents a new and more open development model for us, and we hope that
as a result we'll be able to better interact with and accept patches from the
community, and that Core will become a base that many people can use for
building OCaml applications.
  

4) ocamlbrew
Archive: 

** Hezekiah M. Carty announced:

I would like to announce ocamlbrew, a (very simple, very alpha) tool
for automating and managing builds of OCaml, findlib, and other
OCaml-related items under $HOME on Linux.  ocamlbrew takes it name and
a bit of wrapper code from perlbrew[1].  ocamlbrew provides a thin
bash wrapper around the standard OCaml + findlib build procedure,
taking advantage of odb[2] for further library and tool installations.

ocamlbrew currently lives on github:


With one command[3] ocamlbrew can build OCaml, findlib, oasis, utop,
Batteries, and ocamlscript from source, plus get an easily source-able
file to set up your environment.  Everything will be built and
installed under $HOME/ocamlbrew by default.

ocamlbrew can also be used to build OCaml from any branch on the
official Subversion server.  At this time I recommend using the "-f"
ocamlbrew flag with builds coming from Subversion due to some
incompatibilities between OCaml development versions and oasis.  The
-f flag tells ocamlbrew to only install OCaml, findlib, and odb.ml,
skipping other tools and libraries

[cwn] Attn: Development Editor, Latest Caml Weekly News

2012-01-03 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of December 27, 2011 to 
January 03, 2012.

1) try ocaml website
2) Hashtbl and security
3) Other Caml News


1) try ocaml website
Archive: 

** Continuing the thread from last week, Gabriel Scherer asked and Fabrice Le 
Fessant replied:

> I played with the toplevel a bit, but was frustrated by the limitation
> of one-liner input.
> Even in an interactive toplevel it is nice, I think, to be able to
> write multiline programs.

I uploaded a new version a few minutes ago. Now, you can use "multiline
true" to tell the toplevel that you will use ;; as an end of input
instead of the newline (and "multiline false;;" to switch back). My
patch is inspired from yours, but with minimal changes to the current code.

It works for me, but I would be happy to get feed back from "multi-line
users".
  

2) Hashtbl and security
Archive: 

** Gerd Stolpmann said and Xavier Leroy replied:

> there was recently a security alert for web services that use hash
> tables to store web form parameters sent via POST (so that millions of
> such parameters can be sent in a single request). It is possible to keep
> the web service busy for hours with such a DoS (denial of service)
> attack. The type of attack boils down to a problem in most hash table
> implementations, namely that the hash functions are invertible, and it
> is possible for a malicious user to construct lots of keys that all map
> to the same bucket of the hash table, creating a mass collision.
> 
> The text of the alert: 
> 
> 
> I'd like to discuss this issue, because it is not restricted to the
> processing of web requests, but may also occur for all other data coming
> from untrusted sources. The web is only the most exposed area where this
> issue exists.
> 
> So how is Ocaml affected? The hash functions used in recent Ocaml
> releases are also insecure in the above mentioned sense (currently
> MurmurHash3, and even a simpler hash function in previous releases). A
> quick survey of the Internet revealed at least one site that tries to
> break it. Probably a good cryptographer could do it in minutes. 
> 
> A pure Hashtbl.add of the constructed keys does not yet lead to the
> performance degradation, but a Hashtbl.replace, and of course
> Hashtbl.find after the table is built up will. So it depends very much
> of the details of the programs whether they are affected or not.
> 
> I've just checked that Ocamlnet uses only Hashtbl.add to collect POST
> parameters, so it is not directly vulnerable. But if the crafted request
> is actually served by a handler, the handler would get a degraded table,
> and could show in turn bad performance (again leading to DoS).
> 
> What are possible fixes?
>
> 1) Avoid hash tables in contexts where security is relevant. The
> alternative is Set (actually a balanced binary tree), which does not
> show this problem.

Highly recommended.  Nothing beats guaranteed O(log n) operations.

> 2) Use cryptographically secure hash functions.

Hopeless: with a hash size of 30 bits, as in Caml, or even 64 bits,
there are no cryptographically secure hash functions.

> 3) Use "randomized" hash tables. The trick here is that there is not a
> single hash function h anymore, but a family h(1)...h(n). When the hash
> table is created, one of the functions is picked randomly. This makes it
> impossible to craft an attack request, because you cannot predict the
> function. 

Indeed.  The optional "seed" parameter to Hashtbl.create does exactly
this in the new implementation of Hashtbl (the one based on Murmur3).

> So, the question is how to do 3). I see two problems here:
> 
> a) how to define the family of hash functions. Is it e.g. sufficient to
> introduce an initialization vector for the Murmurhash algorithm, and
> fill it randomly?

IIRC, the Web pages for the Murmur family of hashes gives some
statistical evidence that this approach works.

> How to get a random number that is good enough?

Hmm.  /dev/random is your friend on the platforms that support it.
Otherwise, there's always the Random module, but Random.self_init
isn't very strong.
  
** Gerd Stolpmann then replied:

> Indeed.  The optional "seed" parameter to Hashtbl.create does exactly
> this in the new implementation of Hashtbl (the one based on Murmur3).

I see. It will be available in 3.13:

val create : ?seed:int -> int -> ('a, 'b) t

There is also an additional functorized interface where this seed
argument exists (Hashtbl.MakeSeeded), and the hash 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2011-12-27 Thread Alan Schmitt

Hello,

Here is the latest Caml Weekly News, for the week of December 20 to 27, 
2011.


1) Barista 2.0-alpha2
2) Format OCaml Code
3) try ocaml website
4) Need help for a practical hacking book about ocaml
5) RFC: basename, dirname, PR#4549
6) Other Caml News


1) Barista 2.0-alpha2
Archive: 



** Xavier Clerc announced:

This post announces the 2.0-alpha2 release of the Barista project, whose 
goal

is to provide
a library for Java class file construction and a Java [dis]assembler,
released under the LGPLv3.

Home page: 
Forge page: 

Main changes since 2.0-alpha:
  - move from Java 1.6 to Java 1.7 as default version
  - syntax extension for 'exception pattern' (BARISTA_ERROR)
  - syntax extension for Unicode literals (@"string" and @'c')
  - InputStream.t and OutputStream.t can now be created from functions
  - better error reporting when a signature is invalid
  - helper functions for serialization
  - minor refactoring of code (with small impact on API)
  - removed dependency to 'Str' module
  - bug #73: uniform handling of depencies
  - bug #83: correct construction of constant pool w.r.t. LDC 
instructions



2) Format OCaml Code
Archive: 



** Haihao Shen asked, Mihamina Rakotomandimby replied, and Gabriel 
Scherer then said:


Does anyone know whether there is some tools or scripts to format 
ocaml

code in a unified format?



If you mean having a "good" indentation, opening it in 
Emacs+tuareg-mode

then indenting will work fine.

Note that it's a file by file way and it doesn not split uselessly 
long
lines to shorter ones: just indentation. Or I dont know how to fully 
use

tuareg-mode ;-).

For a large set of files, I don't know how to ease the work.


Camlp4 parses Ocaml source, and can reprint it. You can't customize
the output much, it's defined by the pretty-printer (but you could
write your own pretty-printer), and it probably doesn't correspond to
your own OCaml style. If you're only looking for a way to normalize
indentation, you may be happy with that.

  camlp4o file.ml (* outputs in the console *)
  camlp4o file.ml -o output.ml

Note that piping/redirection `camlp4o file.ml > foo` doesn't work as
camlp4o sends a marshalled AST by default.
An issue with camlp4 is that it can sometimes move comments a bit: the
placement of comments in the reformatted source is approximative *with
respect to whitespace* (you sometimes have a blank inserted between a
phrase and the comment). That is not really an issue for the human
reader, but it tends to confuse `ocamldoc`, which relies on whitespace
heuristics to know which phrase a comment documents. You should think
twice if you wish to use both camlp4 and ocamldoc at the same time.

If you wanted to write your own pretty-printer (as a Camlp4 printer,
or based on your own or another parser), you could be interested in:
- The [Pprint] module of François Pottier, an interesting adaptation
of Daan Leijen's Haskell PPrint library
   
- The [easy-format] library of Martin Jambon
   
- The [Format] module of the standard library
   

I have only used Format and Pprint, and prefer Pprint (simpler to
understand and use).

** rixed then said and Jérémie Dimino replied:


> Note that piping/redirection `camlp4o file.ml > foo` doesn't work as
> camlp4o sends a marshalled AST by default.

This is indeed annoying.
Unfortunately, and quite surprisingly to me, using -o /dev/stdout does
not help.


You can force camlp4 to use the pretty-printer with:

  camlp4o -printer o file.ml > foo

** Jun Furuse replied to the original post:

ocaml-indent may help you, at least around indentations:
 


3) try ocaml website
Archive: 



** Fabrice Le Fessant announced:

  We worked hard on our "Try OCaml" website, started by Çagdas, and we
managed to improve it enough, so that we think people can start using it
(and hopefully, improving it).

It is available here:



  There are 3 lessons, two lessons for "getting a taste of OCaml"
(totalling 10 steps), and the last one about some new features in 3.12.
You can use the "lessons()" command in the toplevel to get

[cwn] Attn: Development Editor, Latest Caml Weekly News

2011-12-20 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of December 13 to 20, 2011.

1) Some comments on recent discussions
2) how could the community help with Oasis-DB; towards a CPAN for OCaml?
3) New experimental ARM backend
4) Don't forget the user
5) About the "mingw" port of OCaml
6) OCaml maintenance status / community fork (again)


1) Some comments on recent discussions
Archive: 

** Deep in this thread, Alain Frisch said and Jonathan Protzenko replied:

> A few points:
> 
> 1. It would be useful to have a completely standalone binary distribution of
> ocaml (with ocamlopt) under Windows. This can be achieved either with little
> development efforts by extracting the minimal needed subset of an mingw
> toolchain (an assembler, a linker, some libraries and object files to link the
> main program); or with a little bit more effort, by avoiding the need for an
> external toolchain altogether. I insist: most users of OCaml under Windows
> won't need a C compiler or Unix-like tools.

I'm considering doing that with the next version of my ocaml installer,
because this has been raised quite a few times on this list already.

> 2. Binary packages for OCaml libraries could be simple .zip files to be
> extracted at a precise place (under the hierarchy created by the OCaml binary
> installer itself); or maybe even Windows installers. If installing a library
> only amounts to clicking on a link in a web page and run the installer, it
> already makes the life of the casual user much easier. We don't necessarily
> need a full-blown packaging system, with dependency tracking, versioning,
> automatic download, etc.

Sure. I've discussed including findlib in the installer for windows [1] so
that people can easily install third-party libraries and have them recognized.

Cheers,

jonathan

[1] 
  

2) how could the community help with Oasis-DB; towards a CPAN for OCaml?
Archive: 

** Deep in this thread, Gabriel Scherer asked and Sylvain Le Gall replied:

> Edgar, It's excellent to know that you have some knowledge of Oasis-DB.
>
> I share the common assumption that this is one of the missing bricks
> of the OCaml ecosystem, and I hope the community at large can help
> with it. I asked Sylvain about it a few months ago, but he wasn't sure
> at that time what was the best way to help. With him now having less
> time available, I was afraid things could stall on that front.

Well things is now less stalled than before my new job. I have pushed a
couple of patches in oasis darcs repository and I am working to deliver
a oasis 0.2.1 sooner or later.

> Could you (or Sylvain) make a more precise picture of how exactly the
> community could help in the Oasis-DB effort?

See above.

>
> Is the priority to upload package (then maybe the warning on the
> webpage advising not to do it seriously should be changed), or are
> there other things we could help with, for example development
> aspects? 

You can upload packages to the server. They won't be lost. The main
point of the dev server DB is for the OCaml community to see if the
service is useful. I won't commit myself into delivering a long term
production server if nobody thinks it is useful.

Helping me to debug by uploading package to oasis-db has 4 "good" effects:
- you use oasis in you project and you can debug it/help me improve it
- you allow other projects to use your package to test oasis-db (e.g odb.ml)
- you increase the visibility of oasis-db and people gradually thinks it
  is a good solution
- it cheers me (ok seems like dumb, but that motivates)

Concerning the dev. aspect see above.

> Who/where should we ask for advice/help when we have issues?

Either you can create a bug in the BTS (or a feature request), send a
mail to 
oasis-devel AT lists.forge.ocamlcore.org,
 have a
chat on #ocaml IRC on freenode (more and more people are able to answer
your question on OASIS here) or send me an email. This should be the
last option because the discussion won't be public.

> It would really help, I think, if:
> - there was a list somewhere of things other people can contribute

Well there is:


> - you talked more about the progress of the effort (I discovered
> 'odb.ml' by absolute chance a few weeks ago, while I follow almost all
> OCaml-related information channels); if people don't know about your
> work, they won't contribute

odb.ml was started by thelema and it remains his project, I let him
communicate on that. But you can see on the home

[cwn] Attn: Development Editor, Latest Caml Weekly News

2011-12-13 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of December 06 to 13, 2011.

1) A busy week on the Caml mailing list
2) OCaml maintenance status / community fork
3) OCaml-rdf
4) Storing ocaml values outside ocaml's heap
5) Generic printer patch
6) LLVM and OCaml status
7) perfect syntax coloring in emacs
8) On packaging
9) About the "mingw" port of OCaml
10) Other Caml News


1) A busy week on the Caml mailing list

** The editor says:

As there has been a huge spike of traffic on the Caml mailing list
this week, I have had to select just a few messages to reproduce here
to keep this summary short. If you want to read everything that has
been said, here are a some links to the threads. I apologize in
advance if I missed a message that should have been included.

The initial threads, from which I'll quote a few messages below,
were about forking OCaml:



They spawned another thread about the community in general:


Another thread was about whether or not using C as a backend:

 
Finally, Gabriel Scherer wrote a long email about Camlp4 and Camlp5,
which spawned some discussion about their maintenance status and
possible alternatives:

  

2) OCaml maintenance status / community fork
Archive: 

** Benedikt Meurer said:

During the last year or two it seems that time and interest in OCaml 
maintenance from the official OCaml development team is diminishing. It takes 
several months to get a patch reviewed (if at all), which is quite 
frustrating for OCaml contributors and even worse for OCaml users. I suspect 
that this is one of the top reasons why there are only a few active 
contributors to OCaml (and the number of active users, at least on the 
mailing list, is declining).

I understand that INRIA does not necessarily pay people for full time 
maintenance jobs on OCaml (and Coq), and the official dev team is probably 
already doing as much as possible to maintain OCaml. Given that OCaml is such 
a nice language with a lot of useful frameworks available, it is too sad to 
see it loosing ground just because of it's closed development process and 
lack of time of the official team.

I'd therefore propose to open up OCaml development to a wider range of 
developers / contributors, to ensure that OCaml will be ready for the 
(functional programming) future. There are already various "OCaml forks" in 
the wild, with different goals and patch sets, so simply starting another 
fork would be rather useless. Instead I'd suggest to bundle efforts in a new 
"OCaml community fork", which is always based on the most recent upstream 
OCaml release (starting point would be 3.12.1 for now), and takes care to 
review and integrate pending patches as well as developing and testing new 
features. Let's say we'd name the fork "OCaml-ng", then we'd try to release a 
new patch set every month or two, based on the official OCaml release, i.e. 
"ocaml-3.12.1+ng201112" and so on, to get early testing and feedback (should 
work together closely with the Debian/Ubuntu/etc. OCaml maintainers).

With this process, OCaml upstream could merge (tested) patches from OCaml-ng 
once they proved working in the wild, and thereby

1. maintenance overhead for INRIA people is reduced,
2. maintenance status of OCaml would be way better,
3. there would be a lot less frustration for possible contributors, and
4. users benefit from a better and more up to date OCaml.

Now that does of course raise a few questions:

1. What is the opinion of the official development team / INRIA on this?
2. Who would help with the community fork?
3. What about infrastructure?
  
** Xavier Leroy replied:

> Maybe we can get back to my original proposal and restart on the
> right foot this time?

All right.  I have a number of concerns about your proposal, most of
which have already been mentioned by others.  Whether you call it a
fork or not, the mere fact of having two separate code bases for
exactly the same software components raises more issues than it solves:

- It complicates the lives of OCaml users, packagers, and 3rd-party
  library developers: what version should they use?  what will be the
  basis for the packagers's distribution-specific patches?  what
  happens if a library is compatible with one version but not the
  other?  what if the community effort 

[cwn] Attn: Development Editor, Latest Caml Weekly News

2011-12-06 Thread Alan Schmitt
Hello,

Here is the latest Caml Weekly News, for the week of November 29 to December 
06, 2011.

1) Parmap 0.9.8
2) Nproc: process pools for OCaml (request for suggestions)
3) PlasmaFS, PlasmaKV, and MapReduce, version 0.5.2
4) OCaml CURL PUT, DELETE
5) Other Caml News


1) Parmap 0.9.8
Archive: 

** Roberto Di Cosmo announced:

a few lines to announce the (much improved) version 0.9.8 of Parmap, the
minimalistic library introduced last August, and that can be useful to exploit
your multicore processor with minimal modifications to your OCaml programs.

You will find a full description in the README file, as well as
several examples.

The main changes are:

 - all functions (parmap, parfold, parmapfold) accept an optional parameter
   chunksize that allows to control granularity of the parallelism

 - highly specialised functions are now present to work on arrays and
   especially on (unboxed) float arrays

 - configure and ocamlbuild harness

 - documentation (just make doc)

 - on Linux kernels, set_affinity is used to attach a worker to a given core

Special thanks to: Jérôme Vouillon for highly efficient code for the float
arrays; Paul Vernaza for clever suggestions on pre-allocation of
memory buffers for float arrays; Pietro Abate for autoconf/ocamlbuild help;
Francois Berenger for tests.

Project home: 

Version 0.9.8 is cc8915bceb7d05c2c645587f5eaaf0f6cb6080c6

To compile and install:

git clone git://gitorious.org/parmap/parmap.git
git checkout pipes
aclocal -I m4
autoconf
./configure
make
make install

Enjoy

-- Marco Danelutto and Roberto Di Cosmo


=Copy of the README file==
Parmap in a nutshell


Parmap is a minimalistic library allowing to exploit multicore
architecture for OCaml programs with minimal modifications: if you
want to use your many cores to accelerate an operation which happens
to be a map, fold or map/fold (map-reduce), just use Parmap's parmap,
parfold and parmapfold primitives in place of the standard List.map
and friends, and specify the number of subprocesses to use by the
optional parameter ~ncores.

See the example directory for a couple of running programs.

DO'S and DONT'S
---

Parmap is *not* meant to be a replacement for a full fledged
implementation of parallelism skeletons (map, reduce, pipe, and the
many others described in the scientific literature since the end of
the 1980's, much earlier than the specific implementation by Google
engineers that popularised them).  It is meant, instead, to allow you
to quickly leverage the idle processing power of your extra cores,
when handling some heavy computational load.

The principle of parmap is very simple: when you call one of the three
available primitives, map, fold, and mapfold , your OCaml sequential
program forks in n subprocesses (you choose the n), and each
subprocess performs the computation on the 1/n of the data, in chunks
of a size you can choose, returning the results through a shared
memory area to the parent process, that resumes execution once all the
children have terminated, and the data has been recollected.

You need to run your program on a single multicore machine; repeat
after me: Parmap is not meant to run on a cluster, see one of the many
available (re)implementations of the map-reduce schema for that.

By forking the parent process on a sigle machine, the children get
access, for free, to all the data structures already built, even the
imperative ones, and as far as your computation inside the map/fold
does not produce side effects that need to be preserved, the final
result will be the same as performing the sequential operation, the
only difference is that you might get it faster.

The OCaml code is reasonably simple and only marginally relies on
external C libraries: most of the magic is done by your operating
system's fork and memory mapping mechanisms.  One could gain some
speed by implementing a marshal/unmarshal operation directly on
bigarrays, but we did not do this yet.

Of course, if you happen to have open channels, or files, or other
connections that should only be used by the parent process, your
program may behave in a very wierd way: as an example, *do not* open a
graphic window before calling a Parmap primitive, and *do not* use
this library if your program is multi-threaded!

Pinning processes to physical CPUs
--

To obtain maximum speed, Parmap tries to pin the worker processes to a
CPU, using the scheduler affinity interface that is available in
recent Linux kernels.  Similar functionality may be obtained on
different platforms using slightly different API. Contributions are
welcome to support those other APIs, just make sure that you use

  1   2   3   4   >