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

2014-04-01 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of March 25 to April 01, 
2014.

1) Experiment: OCaml patch review on github.com/ocaml/ocaml
2) OASIS v0.4.4
3) release 2.0 of itv-tree
4) Trivial compiler patches
5) Anybody interested in creating binary RPMs for each official release of the 
compiler?
6) C++/OCaml position at RTT in Munich
7) OCaml backend developer at Ahrefs in Singapore
8) Other OCaml News


1) Experiment: OCaml patch review on github.com/ocaml/ocaml
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-03/msg00129.html

** Anil Madhavapeddy continued this thread to say:

As a followup to this, I've written a script that syncs all the
open pull requests against the compiler as OPAM compiler switches.
This is now running live on the central OPAM respository.

For instance, if you now `opam update` and look at your switches:

$ opam switch --all
-- -- 4.02.0dev+pr10  Add String.{split,rsplit}
-- -- 4.02.0dev+pr13  Add String.{cut,rcut}.
-- -- 4.02.0dev+pr14  Add absolute directory names to bytecode 
format for ocamldebug to use
-- -- 4.02.0dev+pr15  replace String.blit by String.unsafe_blit
-- -- 4.02.0dev+pr17  Cmm arithmetic optimisations
-- -- 4.02.0dev+pr18  Patch for issue 5584
-- -- 4.02.0dev+pr2   Parse -.x**2. (unary -.) as -.(x**2.).  
Fix PR#3414
-- -- 4.02.0dev+pr20  OCamlbuild: Fix the check of ocamlfind
-- -- 4.02.0dev+pr3   Extend record punning to allow 
destructuring.
-- -- 4.02.0dev+pr4   Fix for PR#4832 (Filling bigarrays may 
block out runtime)
-- -- 4.02.0dev+pr6   Warn user when a type variable in a type 
constraint has been instantiated.
-- -- 4.02.0dev+pr7   Extend ocamllex with actions before 
refilling
-- -- 4.02.0dev+pr8   Adds a .gitignore to ignore all generated 
files during `make world.opt'
-- -- 4.02.0dev+pr9   FreeBSD 10 uses clang by default, with 
gcc not available by default
-- -- 4.02.0dev+trunk latest trunk snapshot

Each switch corresponds to the current development trunk, with the
diff in the PR applied.  If the patch is sane, you can proceed to
install OPAM packages in the experimental tree as usual without
affecting your day-to-day compiler switch.

Hope this is useful!  More details at:
http://anil.recoil.org/2014/03/25/ocaml-github-and-opam.html

It's set to run daily at the moment, and switches will be deleted once
the corresponding pull request is closed.
  
** François Bobot then asked and Louis Gesbert replied:

  I'm just wondering if it is wise to add all these switches to the default 
 OPAM repository. For
 casual ocaml user the useful switches are lost among all these PR.
 
   Perhaps the default possible switches can be reduced to the last releases 
 (for people that work on
 project that must support old version of ocaml) and to the beta and trunk for 
 people that are
 curious of the accepted new features.

That's why in OPAM 1.1.1 we changed `opam switch list` to only display
the default compilers, and you need to add `--all` to see all existing
compiler descriptions. I think it's enough to address your concern.
  

2) OASIS v0.4.4
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-03/msg00137.html

** Sylvain Le Gall announced:

Anil and Jacques-Pascal have quickly spotted a bug when generating
Makefile/META/setup.ml (missing \n\n and a lot of backup files). I
decided to do a quick release tonight to get the situation fixed ASAP.

Here is OASIS 0.4.4
https://forge.ocamlcore.org/frs/?group_id=54release_id=1042
  

3) release 2.0 of itv-tree
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-03/msg00138.html

** Francois Berenger announced:

version 2.0 (in OPAM) allows to attach a value to a given interval.
Useful in case the interval is considered as a key.

The new interface is here:
https://github.com/UnixJunkie/interval-tree/blob/master/lib/interval_tree.mli

It is incompatible with the previous version,
which didn't have those values.
  

4) Trivial compiler patches
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-03/msg00088.html

** Deep in this thread, Anil Madhavapeddy said and Thomas Gazagnaire added:

 There's a significant amount of metadata that isn't track in Git.
 Issues, 

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

2014-03-25 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of March 18 to 25, 2014.

1) BitMasks 1.0.0
2) Core Suite 111.06.00 + async_ssl
3) release of itv-tree 1.0
4) OASIS v0.4.3
5) Other OCaml News


1) BitMasks 1.0.0
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-03/msg00069.html

** David Allsopp announced:

Firstly, many thanks for the various replies to my earlier request for
pointers and guidance on packaging earlier this month.

I'm pleased to announce the release of BitMasks 1.0.0. This library is
designed primarily with C bindings in mind and is yet another solution to
the how do we manipulate integer bitmask flags functionally problem. So,
given an integer where bit 0 means something, bit 1 means something else and
bit 2 yet something further, this library allows that to be exposed as type
t = Foo | Bar | Baz and have the integer be constructed as though it were a
set.

This implementation has three key features:
* Underlying type is provided through a functor (so int or int64 or indeed
an arbitrary precision integer can be used)
* There's no copying, so the original integer can still be used (either
internally or, at the whim of the programmer, the integer can be exposed).
This has significant advantages over, for example, returning the a list of
the bits which are set.
* The resulting signature is compatible with Set.S in the standard library

Project home: http://forge.ocamlcore.org/projects/bitmasks/
Repository: https://github.com/meta-stack/bitmasks
OPAM package: bitmasks

The source includes a full example. I believe having looked at other code
out there that Core follows a similar philosophy.

The original motivation for this library was to provide a sane handling for
the myriad masks of information returned by ODBC's SQLGetInfo function, but
I've found it be useful in other bindings as well (particularly for bindings
for some Raspberry Pi components which I hope to release soon) and hope
others may do too.

Happy functional bit set manipulating!
  
** Yaron Minsky then suggested:

You might be interested also in the Flags module in Core_kernel, which
aims to serve a similar purpose.

https://ocaml.janestreet.com/ocaml-core/111.03.00/doc/core_kernel/#Flags
https://github.com/janestreet/core_kernel/blob/master/lib/flags.ml
https://github.com/janestreet/core_kernel/blob/master/lib/flags.mli
https://github.com/janestreet/core_kernel/blob/master/lib/flags_intf.ml
  

2) Core Suite 111.06.00 + async_ssl
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-03/msg00086.html

** Jeremie Dimino announced:

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

A new package appears with this release: async_ssl. It is an
Async-pipe-based interface with OpenSSL. Bindings to OpenSSL are
written with ctypes.

The following packages were upgraded:

- async_extra
- async_kernel
- async_unix
- core
- core_extended
- core_kernel
- jenga
- re2
- textutils
- typerep

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

https://ocaml.janestreet.com/ocaml-core/111.06.00/individual/
https://ocaml.janestreet.com/ocaml-core/111.06.00/doc/

Here is list of changes for this version:

# 111.06.00

## async_extra

- Added `?on_wouldblock:(unit - unit)` callback to
`Udp.recvmmsg_loop` and `recvmmsg_no_sources_loop`.
- For functions that create `Rpc` connections, added optional
arguments: `?max_message_size:int` and
`?handshake_timeout:Time.Span.t`.

These arguments were already available to `Connection.create`, but
are now uniformly available to all functions that create
connections.

## async_kernel

- Improved the performance of `Pipe.filter_map` by using batching.

## async_ssl

Initial release

## async_unix

- In the `Busy_pollers.t` record, made the `kernel_scheduler` field be
`sexp_opaque`.

Did this so that one doesn't get two copies of the kernel scheduler
in sexps of the scheduler, which already has its own
`kernel_scheduler` field.

## core

- Added inline benchmarks for =Iobuf= and =Time=.

Hera are some of the results from the new benchmarks, with some
indexed tests dropped.

| Name | Time/Run | mWd/Run | Percentage |
|--|--|-|
|
| [time.ml:Time] Time.to_string | 848.74ns | 249.98w | 100.00% |
| [time.ml:Time] Time.to_ofday | 59.66ns | 38.00w | 7.03% |
| [time.ml:Time] Time.now | 39.78ns | 2.00w | 4.69% |
| [time.ml:Time] Time.Zone.find_office | 83.64ns | 4.00w | 9.85% |
| [time.ml:Time] Time.Span.of_hr | 3.71ns | 2.00w | 0.44% |
| [time.ml:Time] Time.Span.of_min | 3.69ns | 2.00w | 0.44% |
| [time.ml:Time] Time.Span.of_sec | 2.72ns | | 0.32% |
| [time.ml:Time] Time.Span.of_ms 

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

2014-03-18 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of March 11 to 18, 2014.

1) I never succeeded in using Format
2) OpenGL and LWT
3) Other OCaml News


1) I never succeeded in using Format
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-03/msg00055.html

** Continuing the thread from last week, François Pottier announced:

Interesting discussion, which prompted me to come out of my retreat and
publish a new implementation of PPrint, available now :-)

Oleg is right: the now-old PPrint implementation uses backtracking and its
time complexity is dependent on the window width.

Oleg's message caused me to think, and I realized that I had missed a major
opportunity for simplification and optimization, which in fact was shortly
thereafter mentioned by Bob in his reply to Oleg's message. The idea is
simple. The PPrint API requires the document to be constructed in an eager,
bottom-up manner. (One reason for this decision was syntax: I did not want the
user to have to write lazy everywhere, and I did not want to impose the use
of a syntax extension.) So, we are paying a high cost in space (linear space
overhead), but in return, it is easy to compute the required width of every
(sub-)document as it is constructed. This in turn means that the rendering
process can be performed in linear time, without dependency on the window
width, without any backtracking or buffering.

I have implemented this idea in the new version of PPrint and compared it with
the old version. In short, the results are as follows, for a set of
randomly-generated documents:

  - the construction of the document is roughly just as fast as it was
(but documents occupy slightly more space in memory)

  - rendering is faster than before, between 2x and 3x faster

  - the code is much simpler than before (this is the key benefit)

  - two features are lost (namely, the primitive operators [nesting] and
[column], which were used to get access to the engine's state during
rendering; they are no longer supported because they prevent the width
pre-computation).

I should point out that rendering is now between 10x and 20x faster than the
construction of the document, which (I believe) means that the current
implementation is essentially unbeatable in terms of throughput. So, in my
view, the bottom line is, if one is willing to live with linear space
overhead, then this approach is preferable for its simplicity and efficiency;
if one must work in constant space, then Oleg's approach is preferable.

The new release of PPrint is available here:

  http://gallium.inria.fr/~fpottier/pprint/pprint.tar.gz

and should reach opam pretty soon (opam install pprint).
  

2) OpenGL and LWT
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-03/msg00056.html

** Deep into this thread, Richard Neswold said and Daniel Bünzli replied:

 Most OpenGL bindings (including LabGL) include 'libglut', which is a
 library that is bundled with OpenGL that opens a UI window with an
 OpenGL context in it. It would be nice to use this library because it
 hides these details (i.e. the same code runs on Unix and MacOSX and
 Windows.) Unfortunately, the way libglut works is you call main_loop()
 which never returns. Before calling main_loop(), you register
 callbacks for mouse and keyboard events. You can also register a
 callback for periodic timeouts. Lastly, there's a callback which gets
 called whenever the libglut main loop is idle (with unspecified
 latencies, frequency, or guarantees.)

I wouldn't use glut which is no longer bundled on osx, is quite limited
in functionality and reclaims your main loop. Use SDL, it provides
similar functionality to setup an OpenGL context in a platform
independent way but it doesn't reclaim control on your main() which will
make integration with lwt trivial. There is:

http://ocamlsdl.sourceforge.net/home.html

I also wrote newer and lower level bindings that target SDL2, they are
not released yet but are becoming stable see:

https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00105.html

(the heisenbug on osx mentioned in that message can be solved see [1]).  

Best,

Daniel

[1] http://lists.ocaml.org/pipermail/ctypes/2014-February/66.html
  
** Daniel Bünzli later corrected:

 I wouldn't use glut which is no longer bundled on osx,

Well that's wrong. But it's no longer recommended, see
https://developer.apple.com/library/mac/qa/qa1613/_index.html
  
** Richard Neswold then said and Daniel Bünzli replied:

 I could have an Lwt thread call Sdl.poll_event and then go to sleep if
 no events were available, but I'm trying to make this driven by events
 and not resort to polling, if possible.

There is 

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

2014-03-11 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of March 04 to 11, 2014.

1) Core Suite 111.03.00
2) I never succeeded in using Format
3) Batteries Included syntax extensions?
4) Other OCaml News


1) Core Suite 111.03.00
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-03/msg00031.html

** Ben Millwood announced:

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

The following packages were upgraded:

- async
- async_extra
- async_kernel
- async_unix
- bin_prot
- core
- core_extended
- core_kernel
- custom_printf
- jenga
- ocaml_plugin
- re2
- sexplib
- textutils

In addition, with this release we are including a new package:

- enumerate, a syntax extension for enumerating finite types.

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

https://ocaml.janestreet.com/ocaml-core/111.03.00/individual/
https://ocaml.janestreet.com/ocaml-core/111.03.00/doc/

Here is the list of changes for this version:

# 111.03.00

## async_extra

- Add `?max_connections:int` argument to `Rpc.Connection.serve`.

`max_connections` is passed to `Tcp.Server.create`, and limits the
number of connections that an Rpc server will accept.

- Improved `Log.Rotation`:

- Made `Log.Rotation.t` abstract; use `create` rather than an
explicit record.
- Added a `` `Dated`` `naming_scheme`.
- Add `Log.Rotation.default`, for getting a sensible default
rotation scheme.
- Added an optional (but discouraged) option to symlink the latest
log file.
- Every log rotation scheme has an associated `Time.Zone.t`.
- Changed the internal representation of `Log.Rotation.t`, but
`t_of_sexp` is backwards compatible, so existing config files will
continue to work.

- Changed `Udp.bind_any` to use `Socket.bind ~reuseaddr:false`, to
ensure a unique port.
- Added `Tcp.Server.listening_socket`, which returns the socket the
server is listening on.

Changed `Tcp.Server` so that if the listening socket is closed, the
server is closed.

- Added to `Udp.Config.t` a `max_ready : int` field to prevent UDP
receive loops from starving other async jobs.
- Improved `File_tail` to cut the number of `fstat` calls in half.

`File_tail` uses a stat loop to monitor a file and continue reading
it as it grows. We had made two `fstat` invocations per loop
iteration, using `Async.Std.Unix.with_file` which constructs an
`Fd.t` and therefore does it own `fstat`. Switching to
`Core.Std.Unix.with_file` with `In_thread.run` eliminated the extra
`fstat`.

## async_unix

- Improved `Socket.accept` to abort and return `` `Socket_closed`` when
the file descriptor underlying the socket is closed.
- Added to `Socket.bind` a `?reuseaddr:bool` argument, preserving the
default as `true`.
- Added `Fd.close_started`, which becomes determined when `close` is
called on an `Fd.t`.

## bin_prot

- Fixed build on ARM.

## core

- Added `Unix.Syslog` module.
- Changed `Command.run` to no longer ignore the first element of its
`~argv` parameter.
- Made `Time.Span.to_short_string` show microsecond precision.

## core_extended

- Added `Set_lang`, a DSL for sets with constants, union, intersection,
and difference.
- In `Process`, use `epoll` rather than `select` when possible,

This prevents errors when selecting on file descriptors numbered
greater than `FD_SETSIZE` (1024).

- Removed `Syslog` module. There is now `Unix.Syslog` in core instead;
the APIs are not compatible, but they are similar.

## core_kernel

- Added `Error.to_string_hum_deprecated` that is the same as
`Error.to_string_hum` pre 109.61.
- Changed `Error.to_string_hum` so that
`Error.to_string_hum (Error.of_string s) = s`.

This fixed undesirable sexp escaping introduced in 109.61 and
restores the pre-109.61 behavior for the special case of
`Error.of_string`. A consequence of the removal of the custom
`to_string_hum` converter in 109.61 was that:

Error.to_string_hum (Error.of_string s) = Sexp.to_string_hum (Sexp.Atom
s)

That introduced sexp escaping of `s`.

- Added to `Doubly_linked` functions for moving an element
within a list.

val move_to_front : 'a t - 'a Elt.t - unit
val move_to_back : 'a t - 'a Elt.t - unit
val move_after : 'a t - 'a Elt.t - anchor:'a Elt.t - unit
val move_before : 'a t - 'a Elt.t - anchor:'a Elt.t - unit

- Improved `Core_map_unit_tests.Unit_tests` to allow arbitrary data
in the map, not just `ints`.

This was done by eta expansion.

## custom_printf

- Simplified the code generated by `pa_custom_printf` to make it
more readable.

## re2

- Fixed a bug with `replace_exn` and anchoring.

Fixed this bug:

$ R.replace_exn ~f:(fun _ - a) (R.create_exn ^) XYZ;;
- : string = aXaYaZa
$ R.replace_exn ~f:(fun _ - a) (R.create_exn ^X) XXXYXXZ;;
- : string = aaaYXXZ

## textutils

- Changed `Textutils.Console` to not reference `Async.Log`, so that
building inline benchmark runners no longer 

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

2014-03-04 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of February 25 to March 04, 
2014.

1) IOCamlJS v0.1
2) Google summer of code
3) Static analysis developer and C/C++ compiler architect positions at 
MathWorks Grenoble
4) Summer internships at Jane Street
5) Bioinformatics Js_of_ocaml GSoC project
6) Other OCaml News


1) IOCamlJS v0.1
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-02/msg00169.html

** Andy Ray announced:

https://github.com/andrewray/iocamljs

IOCamlJS runs a (compiled-to-javascript) OCaml REPL in the IPython
notebook. stdout and stderr are redirected to the notebook interface
so printf works as expected. The js_of_ocaml and lwt syntax extensions
are enabled.

Only a small API for interacting with the notebook is provided by
iocamljs at the moment; js_of_ocaml provides far greater
possibilities.

The demo notebook js_of_ocaml-webgl-demo.ipynb provides a good example
of what can be done. Its an almost direct copy of the js_of_ocaml
WebGL demo except the 3d model, shader code, ocaml code and html code
are all embedded in the notebook and can be compiled and run live in
the browser.

Nothing needs to be (re)compiled for it to run - so long as you have a
IPython 1.1 installed the github repo has everything you need.  It
might even run on Windows(I haven't tried but why not?!).

Cheers,

Andy

PS I have only tested with IPython 1.1 and the way it hacks the
ipython kernel I wouldn't recommend a different version for now.
  
** Andy Ray later added:

 It might even run on Windows(I haven't tried but why not?!).

Why not indeed.  Get IPython from here;

https://www.enthought.com/products/epd/free/

Chrome or Firefox would be best - IE does work but the notebook isn't
looking totally right.
  

2) Google summer of code
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-02/msg00171.html

** Anil Madhavapeddy announced:

Although we didn't apply directly from OCaml, I thought I'd point out two 
projects that have been accepted that do use OCaml.

- MirageOS; a unikernel written in OCaml that compiles to specialised kernels.
  Because a Mirage app is functorized across its OS dependencies, it's possible
  to port it to rather exotic targets such as JavaScript, while maintaining the
  same module interfaces.  Tips and ideas for Mirage available here:
  http://openmirage.org/blog/applying-for-gsoc2014

- Frenetic is a family of network programming languages that let you control
  your network via software defined interfaces.  Ideas for it are up at:
  https://github.com/frenetic-lang/frenetic/wiki/GSoC-2014-Project-Ideas

There may be others here that I haven't spotted:
http://www.google-melange.com/gsoc/homepage/google/gsoc2014

I'd highly recommend any students who have a spare summer coming up to
apply.  Bonus points for any brave souls that propose combining Frenetic
and MirageOS into an OCaml monster that will take over the Internet :-)
  

3) Static analysis developer and C/C++ compiler architect positions at 
MathWorks Grenoble
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-02/msg00173.html

** Tiphaine Turpin announced:

MathWorks is opening two positions in Grenoble, France:
* an expert in static analysis of code using formal methods (model
checking, abstract interpretation or theorem proving...), especially on
concurrent embedded programs, with working knowledge of functional
programming languages
* an expert in C/C++ compiler architecture and framework (like LLVM).

Polyspace tools find bugs and prove their absence in C/C++ applications
and Simulink models, using state-of-the-art static analysis. It is used
to verify embedded software and especially safety-critical systems in
planes, trains, and automobiles.

Please refer to the full job descriptions for application:

Static Analysis and Formal Methods Senior Developer
http://www.mathworks.com/company/jobs/opportunities/Static-Analysis-and-Formal-Methods-Senior-Developer-11754

C/C++ Compiler Architect
http://www.mathworks.com/company/jobs/opportunities/c-c-compiler-architect-11755
  

4) Summer internships at Jane Street
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-02/msg00178.html

** Yaron Minsky announced:

Jane Street is looking to hire functional programmers for our offices
in New York, London and Hong Kong.  Right now we're especially looking
for interns for this upcoming summer.

Interning at Jane 

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

2014-02-18 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of February 11 to 18, 2014.

1) opass 1.0.0
2) IOCaml v0.3
3) Other OCaml News


1) opass 1.0.0
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-02/msg00099.html

** Malcolm Matalka announced:

opass 1.0.0 has been released.  You can get it by updating your opam
repository and doing:

opam install opass

It will install a binary called 'opass'.  You can simply run 'opass' to
see the help screens.

- What is it?

opass is a simple CLI tool for securely storing and managing passwords
and free form data.  It can also be used to generate passwords.  It
assumes the environment you run opass in is secure, but the file can be
safely stored in insecure places.

- How's it work?

It uses gpg to read and write data to a file.  It does all manipulation
in memory and pipes data in and out of gpg.

- What is new in 1.0.0?

There is one backwards breaking change: during a 'search' passwords are
no longer displayed by default.

Other changes:

- search takes multiple terms with an implicit 'and' between them

- Add -show, which will display passwords in a search

- Add -copy, if your search comes down to 1 password entry, take the
  password and pipe it through the program specified in $OPASS_COPY or
  -copy-prog

- Add -copy-prog or $OPASS_COPY, this specifies the program to pipe the
  password to if -copy is used.

If you're on OS X, you can specify 'pbcopy' in order to put the password
in your clipboard.  It think xclipboard exists for Linux as well.

I do all of my ocaml work in a VM, so that means I usually run my ocaml
programs in it, including opass.  In order to get the password to my
physical machine, where my web browser runs, I do:

export OPASS_COPY=ssh 10.0.2.2 pbcopy

I'm sure there are bugs in there, please feel free to email me directly
with issues, or open them on the github page:

https://github.com/orbitz/opass

Special thanks to:
Paolo Donadeo
Dominick LoBraico
Yaron Minsky

for their various contributions and additions.
  

2) IOCaml v0.3
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-02/msg00101.html

** Andy Ray announced:

https://github.com/andrewray/iocaml

IOCaml is an OCaml kernel for the IPython notebook
(http://ipython.org/notebook.html). This provides a REPL within a web
browser with a nice user interface including markdown based
comments/documentation, mathjax formula and the possibility of
generating all manner of HTML based output media from your code. Here
are a few features I think are particularly interesting;

* Uses ocp-index.lib to provide code completion and types (includes
documentation if .cmt files exist). Only works with installed libraries
at the moment. Very new, a wee bit buggy, but I love it.

* I copy/pasted the OCaml core language documentation page into a
notebook. Now you can learn interactively! [1]

* Play with TyXML in the notebook and render typed HTML interactively.

Installation is reasonably painless through opam, though you currently
need to add my remote repository [2] and require a =4.00.1 compiler.
Installation of IPython is a touch more involved as you will have to
update (using 'pip') some python components [3]. Instructions for Ubuntu
13.10 are on the github page and I have also tested Fedora 20 which was,
apart from some slightly different package names, very similar.

Cheers,
Andy

[1] I am not sure if, according to the license terms, I should be
providing this. The documentation has not been changed in any way apart
from one inserted paragraph at the start explaining the difference
between a normal toplevel and the notebook interface. I hope it's OK to
provide this.

[2] I'd love to push this to opam proper but require ocaml-zmq =3.2.
There was a recent discussion on the list about this (indeed reading
about ZeroMQ led me to IPython) so hopefully this will happen before too
long.

[3] I haven't tested this release with 0.13.2 which the distros provide.
Maybe it works anyway.
  
** Anil Madhavapeddy then added:

I've merged a slightly updated release of this in OPAM stable (as iocaml
0.3.1). I also have instructions for getting this up and running on
MacOS+Homebrew here: https://gist.github.com/avsm/9041133

Thanks very much for releasing this Andy; I hadn't realized what an
incredible tool IPython is for teaching until I played with the OCaml
backend here. I'm taking a shot a porting the Real World OCaml guided
tour over to a notebook as well...
  

3) Other OCaml News

** From the ocamlcore planet blog:

Thanks to Alp Mestan, we now 

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

2014-02-11 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of February 04 to 11, 2014.

1) OCamlPro Highlights: Dec 2013  Jan 2014
2) Cmdliner 0.9.4
3) Core Suite 110.01.00
4) OCaml 2014 - Call for Presentations
5) ocaml.org licensing
6) Silicon Valley OCaml programmers
7) Higher-order, Typed, Inferred, Strict: ACM SIGPLAN ML Family Workshop
8) Other OCaml News


1) OCamlPro Highlights: Dec 2013  Jan 2014
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-02/msg00041.html

** Fabrice Le Fessant announced:

Here is the link to OCamlPro's report on its activities in January
2014 on OCaml:

http://www.ocamlpro.com/blog/2014/02/05/monthly-2014-01.html
  
** Romain Bardou said and Benjamin Canou replied:

 Regarding OCamlRes...

 - It like the idea. I already have one use case: images for my GTK icons.

 - There is no .mli in your src directory, it makes your code less
 readable (even empty .mli files are interesting, they tell the reader
 that the module is the main module).

 - Because of the above I was not able to find out what ocplib-ocamlres
 provided.

 - Maybe this is handled by ocplib-ocamlres, but it would be nice if
 there was a way to include resources in the executable at first, and
 then, if the project becomes bigger, have a way to externalize (some of)
 those resources without changing the code. So we would have some
 function such as:

val load_resource: string - string

 taking the resource path (e.g. res/a/x/test.int) and returning the
 contents of the file, either by actually reading an external file, or
 just by returning a string which was included at compile-time. It could
 be as simple as:

 let load_resource path =
try
  Hashtbl.find included_resources path
with Not_found -
  let ch = open_in path in
  ...

 where included_resources is a hash table filled by ocp-ocamlres. (I
 don't think it is very interesting to keep the directory hierarchy, but
 maybe it is for some use cases.)

 - I would probably write a file containing the list of resource files I
 want to include (one per line), and in my build system, add a rule
 saying how to obtain an .ml file from it using ocp-ocamlres. It would
 protect the user from including trash such as Emacs autosaves (~ files ?
 although mines are in a different directory :) ) or Windows Thumbs.db
 files or whatever. You can't be sure what's inside your res directory!
 Maybe your tool could read such a file itself to make it easier and more
 unified.

Thanks for your reactive input. OCamlRes is still in design stage (cf.
the version number) and I published it for gathering potential usages
and users so it is very welcome. About the lack of mli, the
implementation is actually ocamldoc'ed, so a `make doc` and a good
browser should make for a reasonable substitute until the interface is
well frozen in an mli.

For your filesystem overlay use case, this can already be done with a :

let load_resource base rpath =
  try
OCamlRes.(Res.find Path.(of_string rpath) MyResources.root)
  with Not_found -
let fp = open_in (base ^ rpath) in
(* read fp *)

But I agree that it could be generated automatically in a specific format.

Your idea of a master file makes sense. I'm more in favor of polishing
the CLI for filtering files, but I think both approaches can coexist.

I will put a todo / ideas list on github and I invite you (as well as
everyone else) to contribute :)
  
** Malcolm Matalka asked and Anil Madhavapeddy replied:

 I haven't use either, but what is the important differences between
 crunch and ocamlres?

OCamlRes is a much more principled library than crunch -- which
just prettyprints a giant pattern match of strings from a
filesystem tree.

One differentiator of crunch is that it exposes a more system-like
interface, to match the other real backends in Mirage (i.e. a
Lwt_cstruct iterator based on Bigarrays, rather than a string).

I have no problem migrating to ocplib-res eventually, except for
a query I've raised on their bugtracker about the licensing:
https://github.com/OCamlPro/ocp-ocamlres/issues/2
  
** Pierre-Étienne Meunier also asked, and Alain Frisch replied:

 However, what is the difference between new backends, and using llvm?

Since this work is done by OCamlPro on behalf of LexiFi, let me answer
this one. This current project is much less ambitious than switching to
llvm.

Some context: ocamlopt generates machine code by producing some textual
assembly code and calling an external assembler (gas or masm) to produce
object files.  The assembly code is produced directly from an
higher-level intermediate representation defined in
asmcomp/linearize.mli (which represents a list of pseudo-instructions).
The mapping from this representation to assembly language contains some
logic such as picking concrete opcodes (including special cases such as
a 

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

2014-02-04 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of January 28 to February 
04, 2014.

1) OPAM 1.1.1 released
2) Experiment: OCaml patch review on github.com/ocaml/ocaml
3) any automated FFI bindings generators?
4) OCaml CAN support (controller area network)
5) Other OCaml News


1) OPAM 1.1.1 released
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-01/msg00249.html

** Louis Gesbert announced:

We are proud to announce that OPAM 1.1.1 has just been released.

This minor release features mostly stability and UI/doc improvements over OPAM
1.1.0, but also focuses on improving the API and tools to be a better base for
the platform (functions for opam-doc, interface with tools like opamfu and
opam-installer). Lots of bigger changes are in the works, and will be merged
progressively after this release.


== Installing ==

Installation instruction are available here:

  http://opam.ocaml.org/doc/Quick_Install.html

Note that some packages may take a few days until they get out of the pipeline.
If you're eager to get 1.1.1, either use our binary installer:

  https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh

or compile from source:

  https://github.com/ocaml/opam/releases/tag/1.1.1


== About OPAM ==

OPAM is a source-based package manager for OCaml. It supports multiple
simultaneous compiler installations, flexible package constraints, and a
Git-friendly development workflow. OPAM is edited and maintained by OCamlPro,
with continuous support from OCaml Labs and the community at large (including
its main industrial users such as Jane-Street and Citrix).

The official package repository is now hosted at https://opam.ocaml.org,
synchronised with the Git repository at 
http://github.com/ocaml/opam-repository,
where you can contribute new packages descriptions. Those are under a CC0
license, a.k.a. public domain, to ensure they will always belong to the
community.

Thanks to all of you who have helped build this repository and made OPAM such a
success.


== Changes ==

From the changelog:
* Fix `opam-admin make packages -r` (#990)
* Explicitly prettyprint list of lists, to fix `opam-admin depexts` (#997)
* Tell the user which fields is invalid in a configuration file (#1016)
* Add `OpamSolver.empty_universe` for flexible universe instantiation (#1033)
* Add `OpamFormula.eval_relop` and `OpamFormula.check_relop` (#1042)
* Change `OpamCompiler.compare` to match `Pervasives.compare` (#1042)
* Add `OpamCompiler.eval_relop` (#1042)
* Add `OpamPackage.Name.compare` (#1046)
* Add types `version_constraint` and `version_formula` to `OpamFormula` (#1046)
* Clearer command aliases. Made `info` an alias for `show` and added the alias
  `uninstall` (#944)
* Fixed `opam init --root=relative path` (#1047)
* Display OS constraints in `opam info` (#1052)
* Add a new 'opam-installer' script to make `.install` files usable outside of
  opam (#1026)
* Add a `--resolve` option to `opam-admin make` that builds just the archives
  you need for a specific installation (#1031)
* Fixed handling of spaces in filenames in internal files (#1014)
* Replace calls to `which` by a more portable call (#1061)
* Fixed generation of the init scripts in some cases (#1011)
* Better reports on package patch errors (#987, #988)
* More accurate warnings for unknown package dependencies (#1079)
* Added `opam config report` to help with bug reports (#1034)
* Do not reinstall dev packages with `opam upgrade pkg` (#1001)
* Be more careful with `opam init` to a non-empty root directory (#974)
* Cleanup build-dir after successful compiler installation to save on space
  (#1006)
* Improved OSX compatibility in the external solver tools (#1074)
* Fixed messages printed on update that were plain wrong (#1030)
* Improved detection of meaningful changes from upstream packages to trigger
  recompilation
  
** Ian Zimmerman asked and Anil Madhavapeddy replied:

 If I upgrade, can I keep my existing ~/.opam or do I have to rebuild
 everything?

OPAM 1.1.1 shouldn't change the ~/.opam format at all, so you can
interchange OPAM 1.1.0 and 1.1.1 without any problems.

If you do spot some incompatibility, please let us know.
  

2) Experiment: OCaml patch review on github.com/ocaml/ocaml
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-01/msg00254.html

** Gabriel Scherer announced:

TL;DR: During the six next months, we will follow pull requests (PR)
posted on the github mirror of the OCaml distribution, as an
alternative to the mantis bugtracker. This experiment hopes to attract
more people to participate in the extremely helpful and surprisingly
rewarding activity of patch reviews.

Dear OCaml community,

I think we need more people ready 

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

2014-01-28 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of January 21 to 28, 2014.

1) Releases of xtmpl, ocaml-rdf, stog, stog-rdf, stog-writing and genet
2) Announcing yet another Makefile for OCaml
3) Other OCaml News


1) Releases of xtmpl, ocaml-rdf, stog, stog-rdf, stog-writing and genet
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-01/msg00183.html

** Maxence Guesdon announced:

It is my pleasure to announce new releases of various tools and
libraries of mine. The opam packages are already submitted and will be
available soon.

# Xtmpl 0.8 [http://zoggy.github.io/xtmpl/]

Xtmpl is a small XML templating library for OCaml.
This release changes the API to allow fold-like style rewriting.


# OCaml-RDF 0.8.0 [http://zoggy.github.io/ocaml-rdf/]

OCaml-RDF is an OCaml library to manipulate RDF graphs and execute
Sparql queries. This release fix a small bug and adds convenient
functions.


# Stog 0.10.0 [http://zoggy.github.io/stog/]

Stog is a static web site compiler. It is able to handle blog posts as
well are regular pages.
This release contains a lot of changes, listed here:
  http://zoggy.github.io/stog/posts/release-0.10.0.html


# Stog-rdf 0.10.0 [http://zoggy.github.io/stog/plugins/rdf.html]

This Stog plugin allows to easily specify RDF triples within elements,
to produce a RDF graph for the whole generated site. It also permits
executing Sparql queries to include data in the generated pages. 
This release follows Stog's new architecture.


# Stog-writing 0.10.0 [http://zoggy.github.io/stog/plugins/writing.html]

This plugin adds new rewrite rules to use foonotes and bibliographies
in generated pages, with also auto generation of paragraph ids. 
This release follows Stog's new architecture, and include some minor
changes.


# Genet 0.6 [http://zoggy.github.io/genet/]

Genet is tool to build a continuous integration platform. It is
particulary adapted to developments involving various tools working in
chain, that is some tools producing files used by other tools and so
on. This release follows the new API of Xtmpl 0.8.
  

2) Announcing yet another Makefile for OCaml
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-01/msg00187.html

** Christian Rinderknecht announced:

I would like to announce a Makefile for small OCaml projects.

Although this list is read by many seasoned programmers who likely use
ocamlbuild, those who prefer total control over the build process and
beginners alike may find it useful. It is distributed along with a
manual and a detailed documentation in ASCII. The requirements, beyond
the obvious, are GNU Make 3.82 or 4.00 (later recommended for
paralellism), GNU Sed, Linux (with GNU coreutils) or Darwin (OS X) and
dash or bash.

Particular emphasis has been brought to reporting only independent
errors and minimising recompilations. The makefile has no interface
with control version systems, but it detects modifications, deletions
and creations of source files between build cycles, and it reacts
appropriately so there is no need to restart a build cycle from a
clean slate to correct an inconsistency. Note that, as usual with
makefiles, this build system relies only on time stamps to determine
its actions.

Since this is a beta release, you are very welcome to report any
errors. Let me also know if you improve portability (e.g., the sed
regular expressions are mostly compatible with BSD sed, but not
quite).

The urls are

http://pnyf.inf.elte.hu/rinderkn/Software/OCaml/Makefile
http://pnyf.inf.elte.hu/rinderkn/Software/OCaml/Makefile.man
http://pnyf.inf.elte.hu/rinderkn/Software/OCaml/Makefile.doc
  
** William R then asked and Christian Rinderknecht replied:

 could you explain differences with OCamlMakefile

This is a fair question, since Markus' work has been around for quite
a while, but I am afraid that I never used it. Nevertheless, I went
through the documentation and the source code and here are the main
differences I can see at the moment (my apologies to Markus if I am
mistaken):

OCamlMakefile vs my Makefile
* User specifies SOURCES and RESULT vs optional OBJ and BIN
* Order of linking must be specified vs optional
* Builds library and toplevels vs none
* Supports -pack/-for-pack and profiling vs none
* Preprocessors in special comments, no command-line options per
source file vs one tag file per source file + global options
* Generates documentation vs none
* Subprojects vs mono-project
* Support for ocamlfind vs none
* Included in another Makefile vs includes another Makefile
* One native code compilation vs two
* 1300 lines vs 830 lines
* Plethora of phony targets vs two
* Short documentation vs long

OCamlMakefile supports more features than I do, 

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

2014-01-21 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of January 14 to 21, 2014.

1) release of Logtk 0.2
2) Who was working on ocaml bindings for zeromq?
3) yypkg 1.7.0
4) ocaml considered dangerous
5) OCaml on the Arduino (or similar)
6) unboxed-arrays-0.1: Unboxed arrays for OCaml
7) batteries 2.2.0
8) Core Suite 109.60.00
9) Other OCaml News


1) release of Logtk 0.2
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-01/msg00093.html

** Simon Cruanes announced:

I'm happy to announce the release of Logtk 0.2, a pure OCaml library for
(mostly) first-order logic. It focuses on data structures to represent
terms, formulas, types, and provides various algorithms. It is released
under the BSD license.

- main page: https://www.rocq.inria.fr/deducteam/Logtk/index.html
- github: https://github.com/c-cube/logtk
- api doc: http://cedeela.fr/~simon/software/logtk/

The library is currently in a working (*) but unstable state, the API
may change. I'd be very happy to have feedback about bugs, or about the
general usability of the code.

Some algorithms and data structures (extract from README):
- terms
- formulas
- types (simple polymorphism)
- substitutions (for free variables, bound variables use De Bruijn indices)
- first-order unification and matching
- simplification term ordering (RPO, KBO)
- indexing structures for unification/matching (discrimination trees...)
- term rewriting
- congruence closure
- reduction of formulas to CNF (clausal normal form)
- parser for TPTP

To give more context, I use this library for small-ish tools that
process TPTP files, and for an experimental theorem prover for
first-order logic. Yes, it's PhD code ;)

Regards,

-- 
Simon

(*) bugs excepted...
  

2) Who was working on ocaml bindings for zeromq?
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-01/msg00098.html

** Continuing the thread from last week, Anders Peter Fugmann said:

At Issuu we are activly maintaing a fork of pdhborges ocaml-zmq
bindings. We have updated it to support version 3.2 and added new
features such as socket event listening.

I do not know how much work it would require to update that to version
4.0, but I would expect it to be rather strait forward.

You can find the github fork here:
https://github.com/issuu/ocaml-zmq
  

3) yypkg 1.7.0
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-01/msg00143.html

** Adrien Nader announced:

I am happy to release yypkg 1.7.0. This is the release that goes into
win-builds.org 1.3.

Yypkg is a very simple package manager that is also very fast and
portable. Its main selling point is the support of native windows.

Rough changelog:
- symlink emulation on Windows through hardlinks and directory
  junctions; none of them is the same as a symlink but in yypkg's and
  win-builds' context, it's fine.
  (and if you think junctions are good, they're not; they're nothing
  more than hooks on directories at the filesystem/kernel level)
- relevant sexplib sources have been copied inside yypkg and
  (de)serializers are written by hand, avoiding the need for camlp4 and
  type_conv and reducing binary size.
- OCaml 3.11 compat dropped.
- Instead of spawning bsdtar and xz independently with logic to pipe
  between the two, use bsdtar and its bindings the xz' library.
- Remove the GUI; it was probably one of the best example on how to
  create horrible code by first writing a functional CLI core, strapping
  GUI code on it and adding some lwt as a work-around for a blocking
  design.
- Bundle patches against fileutils for symlink handling; I lack time to
  make them mergeable now and I needed this 1.7.0 release and the
  symlink fixes (among others) in time for FOSDEM. Details can be found
  in the corresponding commit message:
  
http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=yypkg/yypkg.git;a=commit;h=f99d37987a7eef3b94fd6b3d2319deced9eebc2e

Homepage: https://forge.ocamlcore.org/projects/yypkg/
Download:
  https://forge.ocamlcore.org/frs/download.php/1364/yypkg-1.7.0.tar.gz
Git repository:
  http://git.ocamlcore.org/cgi-bin/gitweb.cgi?p=yypkg/yypkg.git
Bug tracker is now hosted on win-builds' flyspray instance:
  http://win-builds.org/bugs/index.php?project=2
  

4) ocaml considered dangerous
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-01/msg00145.html

** Deep in this thread, Jacques Garrigue said and oleg added:

 By the way, there is now an implementation 

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

2014-01-14 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of January 07 to 14, 2014.

1) Concurrent/parallel programming
2) Bugs found when porting 0install from python to ocaml
3) ReactiveML 1.09.02
4) External dependency solvers for opam
5) Who was working on ocaml bindings for zeromq?
6) Other OCaml News


1) Concurrent/parallel programming
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-01/msg00020.html

** Yotam Barnoy asked:

So far, I've been programming in ocaml using only sequential programs.
In my last project, which was an implementation of a large machine
learning algorithm, I tried to speed up computation using a little bit
of parallelism with ParMap, and it was a complete failure. It's possible
that more time would have yielded better results, but I just didn't have
the time to invest in it given how bad the initial results were.

My question is, what are the options right now as far as parallelism is
concerned? I'm not talking about cooperative multitasking, but about
really taking advantage of multiple cores. I'm well aware of the runtime
lock and I'm ok with message passing between processes or a shared area
in memory, but I'd rather have something more high level than starting
up several processes, creating a named pipe or a socket, and trying to
pass messages through that. Also, I assume that using a shared area in
memory involves some C code? Am I wrong about that?

I was expecting Core's Async to fill this role, but realworldocaml is
fuzzy on this topic, apparently preferring to dwell on cooperative
multitasking (which is fine but not what I'm looking for), and I couldn't
find any other documentation that was clearer.
  
** Yaron Minsky replied:

This is indeed something that is not well covered in RWO.  That said,
the Async_parallel library is aimed at this kind of target.  No shared
memory region, just some automation around spinning up processes and
communicating jobs between them.
  
** Gerd Stolpmann also replied:

There is Netmulticore, a part of Ocamlnet:

http://projects.camlcity.org/projects/dl/ocamlnet-3.7.3/doc/html-main/Intro.html#ch_comp

It utilizes shared memory, and accesses it from several processes. There
is no C code involved, but it is fairly unsafe nevertheless, because you
need to stick to certain programming rules, or the program crashes.
However, if you manage to encapsulate all the unsafe things, it is a
good option. I'm using Netmulticore in the Plasma Map/Reduce
implementation.
  
** Yotam Barnoy then asked and Gerd Stolpmann replied:

 Gerd, would it be possible to put netmulticore up on opam? I realize
 this is a sensitive topic for you, but from what I can tell, this is
 the most comprehensive and efficient solution to parallel programming
 that exists for ocaml, so why not make it as easily available as
 possible?

Netmulticore is part of Ocamlnet, and I guess you can get it by simply
installing ocamlnet with opam. I'm not the maintainer, so I don't know
whether it is included or not.

 Also, regarding the ocaml_modify() and ocaml_initialize() regression
 in 4.01 -- yikes! Is there any way to get support back for writing
 outside of the ocaml heap? This seems like a pretty big deal! (Sorry
 if I'm arriving late for whatever discussion took place about this
 before).

There is a workaround in place - so far the OS supports it: thanks to
Xavier the symbols caml_modify and caml_initialize are declared as weak
in 4.01, allowing them to be redefined in executables. Netmulticore
redefines these symbols with their pre-4.01 functions.

This isn't optimal yet, because the old write barriers are a bit slower,
and because this introduces a very low-level dependency on the current
version of Ocaml. Nevertheless, it works for now. (Ideas for a better
solution are highly welcome.)
  
** Mark Shinwell then said and Gerd Stolpmann replied:

 Jeremie Dimino and myself have a somewhat embryonic proposal
 that should permit most of the write barrier to be
 circumvented for out-of-heap access, and also avoid the page
 table test.  We'll send mail to the list in due course once
 we've had time to think about this further.

I'm very curious to hear about that.

So far I have only the idea to override the := operator selectively in
all modules that want to modify out-of-heap values:

let ( := ) = Netmcore_heap.assign h

where Netmcore_heap.assign is a C function that tests whether the
destination address is in the out-of-heap address space of h. If so, the
assignment can be done directly. If not, it just falls back to a normal
caml_modify.

This solution isn't nice, though, because it can be very problematic to
have the extra indirection of ref. So, what I'm searching for is a way
to turn any record mutation into an external C function call (or at
least to parametrize the write barrier somehow).
  
** 

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

2014-01-07 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of December 31, 2013 to 
January 07, 2014.

1) Core Suite 109.58.00
2) wrapping a string in an in_channel
3) OpenGL {3,4} and OpenGL ES {2,3} bindings, testers welcome
4) How to see an OCaml change in a browser
5) Other OCaml News


1) Core Suite 109.58.00
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-01/msg2.html

** Jeremie Dimino announced:

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

Starting from 109.55.00, core libraries contain inline benchmark. It
is now possible to run them:

echo 'let () = Inline_benchmarks.Runner.main ~libname:core_kernel'  bench.ml
ocamlfind ocamlopt -thread -linkpkg -linkall -package 
str,core_kernel,core_bench.inline_benchmarks bench.ml -o bench
./bench -benchmarks-runner

Replace core_kernel by the library you want to run benchmarks
for. Currently only core and core_kernel contain inline benchmark.

In this release the following packages were upgraded:

- async
- async_extra
- async_inotify
- async_kernel
- async_parallel
- async_unix
- core
- core_bench
- core_extended
- core_kernel
- jenga
- sexplib

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

https://ocaml.janestreet.com/ocaml-core/109.58.00/individual/
https://ocaml.janestreet.com/ocaml-core/109.58.00/doc/

Here is list of changes for this version:

# 109.58.00

## async_extra

- Changed `Cpu_usage` to use `Core.Percent` instead of `float` where
appropriate.
- Made `Bus.unsubscribe` check that the subscriber is subscribed to
the given bus.
- Made `Log.t` support `with sexp_of`.
- Fixed `Tcp.on_port 0` to return the port actually being listened on,
like `Tcp.on_port_chosen_by_os`.

Previously, a serverlistening on `Tcp.on_port 0` would have its
`Tcp.Server.listening_on` as `0`, which of course is not the port
the server is listening on.

## async_kernel

- Renamed the `Async_core` library as `Async_kernel`, to parallel
`Core_kernel`.

Someday `Async_core` will depend only on `Core_kernel`, but not yet.
- Added a thread-safe queue of external actions that is checked
after each job.
- Fixed a race condition in `Clock.Event.abort`.

Here is the race condition:

* `Clock.Event.at` adds an alarm, its value is a job (let's call it
job1) with this run function:

```ocaml
let fire () `
t :` Happened;
Ivar.fill ready `Happened;
```
* later a job (let's call it job2) aborting the clock event is queued
in the async scheduler
* in the same cycle, the `Timing_wheel.advance_clock` fires the
alarm and job1 scheduled
* at this point:
+ job1 and job2 are still pending
+ the alarm was removed so it is invalid
+ the clock event is still in the state `Waiting`
* job2 is executed before job1: the clock event is still in the
`Waiting` state, so the abort tries to remove the alarm from the
timing wheel: CRASH

The bugfix is for `Clock.Event.abort` to check if the alarm has
already been removed from the timing wheel and if so, don't remove
it again.
- Changed `Monitor.try_with` when run with `~rest:\`Ignore`, the
default, so that the created monitor is detached from the monitor
tree.

The detached monitor has no parent, rather than being a child of the
current monitor. This will eliminate recently observed space leaks
in `Sequencer_table` and `Throttle`, like:

```ocaml
let leak () =
let seq = Throttle.Sequencer.create () in
let rec loop n =
Throttle.enqueue seq (fun () -
loop (n + 1);
Deferred.unit
)
| don't_wait_for
in
loop 0
```
- Changed Async's scheduler to pool jobs rather than heap allocate
them, decreasing the cost of a job by 30-40%.

Changed the main scheduler queue of jobs to be an `Obj_array.t` that
is essentially a specialized `Flat_queue` (the specialization was
necessary for speed).

Also, cleaned up the scheduler run-job loop.

With these changes, the cost of a simple job decreases significantly
(30-40%), across a range of live data sizes. Here are the
nanoseconds-per-job numbers for a microbenchmark with the old and
new approaches.

```
| num live jobs | old ns/job | new ns/job |
|---++|
| 1 | 74 | 53 |
| 2 | 75 | 47 |
| 4 | 76 | 41 |
| 8 | 63 | 39 |
| 16 | 62 | 38 |
| 32 | 61 | 37 |
| 64 | 61 | 37 |
| 128 | 60 | 37 |
| 256 | 60 | 38 |
| 512 | 60 | 38 |
| 1024 | 60 | 39 |
| 2048 | 61 | 40 |
| 4096 | 67 | 41 |
| 8192 | 65 | 45 |
| 16384 | 75 | 56 |
| 32768 | 115 | 67 |
| 65536 | 171 | 108 |
| 131072 | 255 | 158 |
| 262144 | 191 | 130 |
| 524288 | 216 | 139 |
| 1048576 | 238 | 152 |
```

See async/bench/nanos\_per\_job.ml for the benchmark.
- Removed `debug_space_leaks` from Async's internals. It hadn't been
used in years.

## async_unix

- Improved fairness of the async scheduler with respect to external
threads, including I/O done in external threads.

The change is to add a thread-safe queue of 

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

2013-12-31 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of December 24 to 31, 2013.

1) OCaml Labs activities in 2013
2) Lablqt
3) Other OCaml News


1) OCaml Labs activities in 2013
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00202.html

** Anil Madhavapeddy announced:

We've put together a review of most of the activities that we've done at
OCaml Labs in Cambridge during our first year in 2013, available at:

http://anil.recoil.org/2013/12/29/the-year-in-ocamllabs.html

This will also be mirrored at the OCaml Labs homepage:
http://www.cl.cam.ac.uk/projects/ocamllabs/

Thanks again to all our collaborators for making this such a productive
and enjoyable 2013, and we wish everyone a happy and prosperous 2014.
  

2) Lablqt
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00203.html

** Continuing this two weeks old thread, Vsevolod Velichko said:

As I was the beta-tester of the lablqml, I can share some of my
experience :)

I've written an example[1] that creates a couple of views on top of
OCaml-created data models, emits signals from OCaml, calls OCaml
callbacks from QML and so on. It can be taken into account as some proof
of concept.

At first, as Dmitry said there's some simple hardcoded startup, but it
was added on behalf of my request (I wanted one to be able to use GUI
without writing any line of C++ code). However one can still put their
own startup in C++.

Second, the developer still must deal with C++ compilation and linking
OCaml object files with C++ ones. AFAIK, Dmitry intends to improve the
process in some future, but currently it a bit tricky. I haven't tried
native OCaml build systems (such as ocamlbuild or omake) with it yet,
but using the Makefile one can see, that they have to manually resolve
all the Qt libraries to link with.

Third, there're still some issues. E.g. creating the data item object
used in view, I was unable to create a mutable property that can be used
on top level of delegate[2] so I had to expose[3] the object itself and
access its property, otherwise property changes weren't revealed to QML.

But anyway while lablqt is still to be considered as some beta release,
I claim that it is already more usable than e.g. lablgtk.

[1] https://github.com/torkve/melange-seawar
[2] https://github.com/torkve/melange-seawar/blob/master/gui.qml#L85
[3] https://github.com/torkve/melange-seawar/blob/master/gui.ml#L43
  

3) Other OCaml News

** From the ocamlcore planet blog:

Thanks to Alp Mestan, we now include in the OCaml Weekly News the links to the
recent posts from the ocamlcore planet blog at http://planet.ocaml.org/.

Costa's minimal surface with PovRay:
  http://math.andrej.com/2013/12/30/costas-minimal-surface-with-povray/

Announcing a new OCaml library for the Adafruit Raspberry Pi RGB LCD!:
  http://gallium.inria.fr/blog/raspi-lcd

Reviewing the first year of OCaml Labs in 2013:
  http://anil.recoil.org/2013/12/29/the-year-in-ocamllabs.html

Haskell : The Problem with Integer.:
  http://www.mega-nerd.com/erikd/Blog/CodeHacking/Haskell/integer_pt1.html

OCaml EFL 1.8.0 released:
  https://forge.ocamlcore.org/forum/forum.php?forum_id=893
  

Old cwn


If you happen to miss a CWN, you can send me a message
(alan.schm...@polytechnique.org) and I'll mail it to you, or go take a look at
the archive (http://alan.petitepomme.net/cwn/) or the RSS feed of the
archives (http://alan.petitepomme.net/cwn/cwn.rss). If you also wish
to receive it every week by mail, you may subscribe online at
http://lists.idyll.org/listinfo/caml-news-weekly/ .



___
caml-news-weekly mailing list
caml-news-weekly@lists.idyll.org
http://lists.idyll.org/listinfo/caml-news-weekly


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

2013-12-24 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of December 17 to 24, 2013.

1) final release of OPAM 1.1.0
2) OASIS v0.4.1
3) Camlp4 on github
4) OCaml 4.00.1 for HP-UX and AIX
5) Moving ocaml to github (as well)
6) InvarGenT v1.1: GADTs for invariants and postconditions
7) Win-builds 1.3 RC1 - Package manager on/for Windows with cross-compilers
8) Other OCaml News


1) final release of OPAM 1.1.0
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00116.html

** Continuing the thread from last week, Malcolm Matalka announced:

I have updated and submitted the OPAM 1.1.0 Nix package to NixPkgs, the
pull request can be followed here:

https://github.com/NixOS/nixpkgs/pull/1393

It should be merged in a day or two.
  

2) OASIS v0.4.1
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00135.html

** Sylvain Le Gall announced:

I have just released OASIS v0.4.1 to fix a bug with threads compilation.

You can get the release here:
https://forge.ocamlcore.org/frs/?group_id=54

Here is the changelog:

  * Major changes:

 * Fix broken compilation with threads and OCaml = 4.01 (Closes: #1358)

  * Minor changes:

* Refactor plugins for command line interface.
* Get rid of message 'field is set but no matching plugin' (Closes: #795, 
#1043).

  * Features:

* dynrun_for_release (alpha):
   * The goal of this plugin is to allow creating release with a minimal
 setup.ml that uses '-setup-update dynamic'.
   * Refactor setup.ml to perform early checks. like looking for findlib
 and oasis.dynrun library and warns the user in case they cannot be
 found (early configure script).
   * Along setup.ml, Makefile and configure, also keep INSTALL.txt if
 StdFiles plugins is used to provide a readable list of package to
 install.

  * Addendum to 0.4.0 release:
   * Since 0.4.0 OASIS has a limited support to syntax extension. If in the
 list of BuildDepends, one of the library ends with .syntax, OASIS 
will
 add the tag syntax_camlp4o to all files of this library. This new
 feature already covers some common case of using syntax extensions.
  

3) Camlp4 on github
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00143.html

** Jeremie Dimino announced:

As you may have noticed, a few weeks ago the camlp4 folder disappeared
from the subversion repository of OCaml. Since there was no technical
reason to keep Camlp4 in the official distribution
and it was making work on the compiler harder than necessary, It was
decided to make it an external project.

Camlp4 then started his second life on github. The official repository
is at this address:

https://github.com/ocaml/camlp4

New bug reports should go there. We can keep using the mantis bug
tracker for existing tickets, though it would be better if people could
move their tickets to github.
  

4) OCaml 4.00.1 for HP-UX and AIX
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00156.html

** Christoph Bauer:

there is an update for the ports of OCaml 4.00.1 to AIX and HP-UX. This
is the last update of both ports.

http://ocaml-ports.geschenker.net/ocaml-hpux.html

http://ocaml-ports.geschenker.net/ocaml-aix.html
  

5) Moving ocaml to github (as well)
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00159.html

** Yotam Barnoy asked, triggering some discussions:

Following on the news that camlp4 has been moved to github, I would like
to see ocaml moved to github as well (the main repository, that is --
not a mirror):

a. The ocaml code seems under-documented, with some files still having
French documentation. I have a feeling folks on this list could do a
great job adding thorough documentation to the code if a push was made
to do that. If people could add some documentation and then make a pull
request for their documented files, we'd soon have much better
documentation.
b. Better documentation would lead to more people hacking the code,
which could help accelerate ocaml development. For example, it appears
that one sorely needed feature is proper backend multiplexing. The llvm
backend that was developed a couple of years back was forked by some
people to develop heavy features, and now 

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

2013-12-17 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of December 10 to 17, 2013.

1) opam-installer (beta)
2) ocamlbuild plugins and external libraries
3) Dead code detection
4) InvarGenT: GADTs-based invariant/postcondition generation
5) Symbolizer for caml-inspect
6) OASIS v0.4.0
7) cryptodbm.0.8: key-value database with encryption
8) Lablqt
9) SDL2 bindings, testers and feedback welcome
10) Other OCaml News


1) opam-installer (beta)
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00068.html

** Daniel Bünzli asked, said, then Louis Gesbert announced:

  Manual Package Management?, the file format of .install is very
  simple you could perfectly develop have a command line tool that reads
  it and issues the appropriate cp commands,
 
 In fact, thanks to Louis Gesbert, this tool already seems to exist since 17 
 days:
 
 https://github.com/ocaml/opam/pull/1026

Hah, Daniel, you're too fast, it actually just landed into OPAM trunk just now !
So here is the official announcement :)

OPAM now installs together with a small opam-installer script designed
just towards that goal: it handles .install files, and can be used to
install or remove any package that generates them, independently of
OPAM. Hopefully this will help the acceptation of this format as a
standard, both easing the programmer's (and build-system writer's) work
and providing better integration with the packaging system.

Additionally, opam-installer can generate shell-scripts that could be
used, for example, for distributing to targets which don't have the
tool.

This is still in beta stage, all reports welcome.
  

2) ocamlbuild plugins and external libraries
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00074.html

** Gregory Malecha asked and Gabriel Scherer replied:

 I have several ocamlbuild plugins that are very similar and I'm trying
 to figure out how to refactor them. I pulled out a bunch of definitions
 into another file (coq_paths.ml) and then said 'open Coq_paths' in '
 myocamlbuild.ml'. But when I do this, ocamlbuild can no longer build the
 plugin, not even if foo.cmo already exists in the _build directory.
 
 After hacking on this for a long time (and digging through the
 ocamlbuild sources) I found that you can write a Makefile that will
 build myocamlbuild.cmo using ocamlbuild without a plugin, and then
 manually link this against ocamlbuild.cmo and to produce a custom
 version of ocamlbuild that uses the plugin (this is exactly what
 ocamlbuild does). My question is: 'is there any nicer way to do this?'
 I'm including my Makefile below:
 
 OCAMLBUILDDIR=$(shell ocamlfind query ocamlbuild)
 
 all: _build/coq_builder
 @ ./_build/coq_builder -no-plugin coq.otarget
 
 _build/coq_builder: myocamlbuild.ml coq_paths.ml
 @ echo building builder
 @ ocamlbuild -cflags -I,`ocamlfind query ocamlbuild` -no-plugin
 myocamlbuild.cmo
 @ ocamlc.opt unix.cma -I $(OCAMLBUILDDIR) $
 (OCAMLBUILDDIR)/ocamlbuildlib.cma \
 _build/coq_paths.cmo _build/myocamlbuild.cmo \
 $(OCAMLBUILDDIR)/ocamlbuild.cmo -o _build/coq_builder
 @ echo done
 
 clean:
 ocamlbuild -clean

Since 4.01, ocamlbuild supports a new (experimental) option
-plugin-tag that allows to specify (built-in) ocamlbuild tags to use
when compiling myocamlbuild.ml. If you package coq-paths using findlib,
you can then use

ocamlbuild -use-ocamlfind -plugin-tag package(coq-path) ...
  

3) Dead code detection
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00078.html

** Pierre-Yves Strub asked:

Does any of you know a tool for doing dead code detection?
  
** Simon Cruanes replied:

I don't use such a tool but I remember that Ocamlpic contains something
similar for shrinking bytecode files. See
http://www.algo-prog.info/ocaml_for_pic/web/index.php?id=OCAPIC:OCamlClean

It would be great to have such a standalone tool on opam, though.
  
** Fabien Renaud also suggested:

You can try https://github.com/Michaaell/dead-code-detection (which
requires OCaml 4).
  
** Alain Frisch also suggested:

At LexiFi, we use two different techniques for detecting dead code:

 - Bisect, for a dynamic notion of dead code (i.e. code which is not
exercised by our testsuite).

 - A custom static detection tool, which parses .cmt and .cmi files to
detect exported components (values, exceptions, etc) used by no other
module in the project.  This is of course combined with the existing
compiler warnings on locally unused and non-exported declarations.

The next version of OCaml will make it extremely simple to 

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

2013-12-10 Thread Alan Schmitt
Hello,

Here is the latest OCaml Weekly News, for the week of December 03 to 10, 2013.

1) Wojciech Meyer
2) Polymorphic recursion and GADTs
3) Other Caml News


1) Wojciech Meyer
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00035.html

** Vitaly S. Lugovskiy gave some sad news:

It is with great sadness that I am writing to inform that Wojciech
Daniel Meyer, who was known in the OCaml community, passed away 18th
November 2013 at the age of 32.
  

2) Polymorphic recursion and GADTs
Archive: https://sympa.inria.fr/sympa/arc/caml-list/2013-12/msg00053.html

** Lukasz Stafiniak asked:

I am at a loss as to the difference between ['a.] syntax and [type a.]
syntax of introducing polymorphic recursion. I will provide some examples.
(Bear with me, they are automatically generated.)

type _ term =
  | Lit : integer - integer term
  | Plus : integer term * integer term - integer term
  | IsZero : integer term - boolean term
  | If : (*?'a.*)boolean term * 'a term * 'a term - 'a term
and integer

and boolean

external plus : (integer - integer - integer) = plus
external is_zero : (integer - boolean) = is_zero
external if_then : (boolean - 'a - 'a - 'a) = if_then
let rec eval : 'a . ('a term - 'a) =
  (function Lit i - i | IsZero x - is_zero (eval x)
| Plus (x, y) - plus (eval x) (eval y)
| If (b, t, e) - if_then (eval b) (eval t) (eval e))

The above produces:
Error: This pattern matches values of type boolean term
   but a pattern was expected which matches values of type integer term
   Type boolean is not compatible with type integer
but if we replace the corresponding line with:

...
let rec eval : type a . (a term - a) =
...

then it compiles fine.

Now to a more complex example. According to my understanding (and
InvarGenT), the following code should type-check:

type _ place =
  | LocA : a place
  | LocB : b place
and a
and b

type (_, _) nearby =
  | Here : (*?'b.*)'b place * 'b place - ('b, 'b) nearby
  | Transitive : (*?'a, 'b, 'c.*)('a, 'b) nearby * ('b, 'c) nearby -
('a, 'c) nearby
type boolean

external is_nearby : (('a, 'b) nearby - boolean) = is_nearby
type _ ex1 =
  | Ex1 : (*?'a, 'b.*)('b place * ('a, 'b) nearby) - 'a ex1
external wander : ('a place - 'a ex1) = wander
type (_, _) meet =
  | Same : (*?'b.*) ('b, 'b) meet
  | NotSame : (*?'a, 'b.*) ('a, 'b) meet
external compare : ('a place - 'b place - ('a, 'b) meet) = compare
let rec walk : type a b . (a place - b place - (a, b) nearby) =
  (fun x goal -
((function Same - Here (x, goal)
   | NotSame -
   let Ex1 ((y, to_y)) = wander x in Transitive (to_y, walk y
goal)))
  (compare x goal))

Here we get
Error: This expression has type b place
   but an expression was expected of type a place
   Type b is not compatible with type a
And when we switch to the ['a.] syntax, we get
Error: This definition has type 'a. 'a place - 'a place - ('a, 'a) nearby
   which is less general than
 'a 'b. 'a place - 'b place - ('a, 'b) nearby

Thanks in advance for any thoughts.
If you are curious, the source code is:
https://github.com/lukstafi/invargent/blob/master/examples/simple_eval.gadt
https://github.com/lukstafi/invargent/blob/master/examples/equational_reas.gadt
  
** Gabriel Scherer replied:

TL;DR: you should use those rigid variables to annotate type variable
that will be refined in a GADT pattern matching.

The way GADT type variables can be refined with different types in each
branches is different and orthogonal to the type unification mechanism.
Variables ('a) use type unification on each branch, which fails with the
error you observe. Local type constructors (a), and only them, can be
refined in GADT clauses, so that type refinement works. The syntax
  let rec f : type a . a - ... = fun x - ...
as opposed to
  let rec f (type a) (x : a) ... = ...
combines the GADT-readiness of those weird variables with polymorphic
recursion -- which is orthogonal, but in practice they often come together.

For more technical details, see Ambivalent types for type inference with
GADTs, by Jacques Garrigue and Didier Rémy, 2013:
http://gallium.inria.fr/~remy/gadts/Garrigue-Remy:ga...@short2013.pdf
  

3) Other OCaml News

** From the ocamlcore planet blog:

Thanks to Alp Mestan, we now include in the OCaml Weekly News the links to the
recent posts from the ocamlcore planet blog at http://planet.ocaml.org/.

Mirage 1.0: not just a hallucination!:
  http://openmirage.org/blog/announcing-mirage10

RWO tidbits: the runtime:
  

<    1   2   3   4