﻿ OCaml Weekly News Previous week Up Next week

Hello

Here is the latest OCaml Weekly News, for the week of March 06 to 13, 2018.

### Release of Interval 1.4

Christophe announced:
```It is my pleasure to announce the release of the library _Interval_, version
1.4. _Interval_ is a library developed by Jean-Marc Alliot, Jean-Baptiste
Gotteland and slightly improved by myself, which implements
[interval-arithmetic](https://en.wikipedia.org/wiki/Interval_arithmetic):
a mathematical value _x_ is represented on the computer as an interval _[x]_
with machine numbers as bounds such that _x ∈ [x]_ (of course the tighter the
interval, the better). All mathematical functions are _lifted_ to functions
taking and returning intervals.
The following interactive session:
```ocaml
# #require "interval";;
# open Interval;;
# let x = I.v 1. 1.;;
val x : Interval.t = {low = 1.; high = 1.}
# I.sin x;;
- : Interval.t = {low = 0.841470984807896505; high = 0.841470984807896616}
```
constructs an interval `x` with lower and upper bounds 1 (thus 1 ∈ x since 1 is
exactly representable) and the next line computes an interval containing the
true value of the sine on 1 (thus taking into account all rounding and
truncation errors along the computation). You can read this as the fact that the
exact value of _sin(1)_ belongs to the interval _[0.841470984807896505,
0.841470984807896616]_.

reports,... see the [Github page](https://github.com/Chris00/ocaml-interval).
```

### A proposal for a resource-management model for OCaml

Guillaume Munch-Maccagnoni announced:
```I would like to offer for discussion a proposal for a resource management model
for OCaml. It proposes to extend the OCaml language with RAII, move semantics
and resource polymorphism.

https://hal.inria.fr/hal-01724997

> We present a resource-management model for ML-style programming languages,
> designed to be compatible with the OCaml philosophy and runtime model. This is
> a proposal to extend the OCaml language with destructors, move semantics, and
> resource polymorphism, to improve its safety, efficiency, interoperability,
> and expressiveness. It builds on the ownership-and-borrowing models of systems
> programming languages (Cyclone, C++11, Rust) and on linear types in functional
> programming (Linear Lisp, Clean, Alms). It continues a synthesis of resources
> from systems programming and resources in linear logic initiated by Baker.
>
> It is a combination of many known and some new ideas. On the novel side, it
> highlights the good mathematical structure of Stroustrup's “Resource
> acquisition is initialisation” (RAII) idiom for resource management based on
> destructors, a notion sometimes confused with finalizers, and builds on it a
> notion of resource polymorphism, inspired by polarisation in proof theory,
> that mixes C++'s RAII and a tracing garbage collector (GC). In particular, it
> proposes to identify the types of GCed values with types with trivial
> destructor: from this definition it deduces a model in which GC is the default
> allocation mode, and where GCed values can be used without restriction both in
> owning and borrowing contexts.
>
> The proposal targets a new spot in the design space, with an automatic and
> predictable resource-management model, at the same time based on lightweight
> and expressive language abstractions. It is backwards-compatible: current code
> is expected to run with the same performance, the new abstractions fully
> combine with the current ones, and it supports a resource-polymorphic
> extension of libraries. It does so with only a few additions to the runtime,
> and it integrates with the current GC implementation. It is also compatible
> with the upcoming multicore extension, and suggests that the Rust model for
> eliminating data-races applies.
>
> Interesting questions arise for a safe and practical type system, many of
> which have already been thoroughly investigated in the languages and
> prototypes Cyclone, Rust, and Alms.
```
Ivan Gotovchits asked and Guillaume Munch-Maccagnoni replied:
```> Also, are there any publically available artifacts of this work, besides the
> book itself?

The quoted OCaml code is available here:
https://guillaume.munch.name/files/ocaml-raii.ml
```

### Profiling in OCaml?

Deep in this thread, Yawar Amin said:
```Hi Douglas, OCaml includes a feature to warn if your `rec` function is not
tail-recursive:
https://caml.inria.fr/pub/docs/manual-ocaml-4.06/extn.html#sec260

> “ocaml.tailcall” or “tailcall” can be applied to function application in order
> to check that the call is tailcall optimized. If it it not the case, a warning
> (51) is emitted.

E.g.

```ocaml
[@ocaml.tailcall] let rec f x = if x < 1 then x else 1 + tail (x - 2)
```

...should warn.

Btw @octachron, I don't believe Bob was saying 'port it to BuckleScript', it was
more '_If_ you can port to BuckleScript'.
```
```@yawaramin I think the annotation should be at the call site? I think it should be
```
let rec f x = if x < 1 then x else 1 + (f [@tailcall]) (x - 2)
```
at least on cursory testing it did not work before the `let rec` for me.
```

### Lwt 3.3.0 and Lwt_ppx 1.1.0 released – nice stack traces restored

Anton Bachin announced:
```We are pleased to announce release **3.3.0** of
[**Lwt**](https://github.com/ocsigen/lwt), the promise and concurrent I/O
library. **Lwt_ppx** **1.1.0** is released simultaneously.

The main highlight is that proper stack trace support is restored in the PPX
(thanks [Gabe Levi](https://twitter.com/evilgabe)!). Stack traces now look like
this:

```text
Raised at file "pervasives.ml", line 32, characters 17-33
Called from file "test.ml" (inlined), line 1, characters 14-29
Called from file "test.ml" (inlined), line 6, characters 23-39
Called from file "test.ml", line 13, characters 13-31
Called from file "src/core/lwt.ml", line 1950, characters 23-26
Re-raised at file "test.ml", line 8, characters 2-117
Re-raised at file "test.ml", line 25, characters 0-70
```

For *a couple years*, they would just stop at the `src/core/lwt.ml` entry
(argh!), even though, in this case, `Pervasives.failwith` was called at
`test.ml` line 1.

There are several other important fixes and improvements. From the
[changelog](https://github.com/ocsigen/lwt/releases/tag/3.3.0):

> Bugs fixed
>
> - Restore backtrace support ([#554](https://github.com/ocsigen/lwt/pull/554),
> [#556](https://github.com/ocsigen/lwt/pull/556), Gabe Levi).
> - Serious logic error that could cause Lwt to hang or crash
> ([#549](https://github.com/ocsigen/lwt/issues/549), reported @koen-struyve).
> - All `Lwt_list` functions are now tail-recursive
> ([#538](https://github.com/ocsigen/lwt/pull/538), @jsthomas).
>
>
> - Support `;%lwt` syntax in the PPX
> ([#307](https://github.com/ocsigen/lwt/pull/307), @hcarty).
> - `Lwt_stream.iter_n` ([#312](https://github.com/ocsigen/lwt/pull/312), @hcarty).
>
> Miscellaneous
>
> - Testing improvements ([#536](https://github.com/ocsigen/lwt/pull/536),
> [#541](https://github.com/ocsigen/lwt/pull/541), @cedlemo).
> - Documentation improvements ([#544](https://github.com/ocsigen/lwt/pull/544),
> [#546](https://github.com/ocsigen/lwt/pull/546),
> [#547](https://github.com/ocsigen/lwt/pull/547),
> [#553](https://github.com/ocsigen/lwt/pull/553),
> [#559](https://github.com/ocsigen/lwt/pull/559), @dmbaturin, Jason Evans, Jess
> Smith, Milo Turner).

Many thanks to all the contributors!

https://github.com/ocsigen/lwt
```

### Tarides is looking for software engineers to work on MirageOS and Irmin

Thomas Gazagnaire announced:
```Hi all, please forward this to anyone would could be interested :-)

---

Tarides is looking for software engineers to help developing and maintaining the
MirageOS[1] unikernel project and Irmin[2], a Git-like library database.

Founded in Paris in early 2018, Tarides helps developers and companies build
secure, performant and resource-efficient network and storage services. We are
operating system and Irmin to create scalable distributed applications. Tarides
offers commercial support and commercial development services for companies
interested to run MirageOS or Irmin as part of their technology stack.

Depending on experience and interests the job will involve:

- Using MirageOS or Irmin to develop new applications for our customers;
- Interfacing with the wider MirageOS community to work out a consistent
architecture for the project and help defining its evolution;
- Designing, developing and maintaining new functionalities and open-source
libraries for MirageOS, such as a fast buffer library or an extensible
connection framework;
- Becoming a maintainer for existing MirageOS libraries;
- Working with the OCaml compiler toolchain and the upcoming OCaml platform to
ensure that it has all the features required for high performance and secure
MirageOS operations;
- Identifying and developing missing functionalities to make Irmin the reliable
storage persistence layer of the MirageOS platform;
- Improving user-facing interfaces (CLI, bindings and API) for Irmin to turn it
into a successful general-purpose database on its own.

We are opening permanent positions in our (future) office based in Paris, but
remote work is also possible. We are looking for candidates with a good
knowledge of OCaml, with an interest in operating systems (virtualisation,
networking or storage). Previous or existing contributions to open-source
projects are welcome and encouraged.

Tarides is a very young company, so expect a lot of flexibility in your work
assignments. Be prepared to wear many hats and to sometimes go beyond your
open-source contributions) and questions to thomas@tarides.com.

[1]: https://mirage.io
[2]: https://mirage.io/blog/introducing-irmin
```

### Emile 0.2 - e-mail address decoder

Calascibetta Romain announced:
```I'm happy to announce the second version of
[Emile](https://github.com/dinosaure/emile.git). Emile is a little library which
depends on `angstrom` (`0.9`), `fmt`, `ipaddr` and `uutf`, and aims to decode
e-mail adresses. We could believe it&#39;s easy to parse e-mail, but, as I said
to [my last conference at ICFP

So, I decided to extract from [Mr. Mime](https://github.com/oklm-wsh/MrMime.git)
the e-mail address parser and release it to let users recognize and understand

Thus we provide some functions to recognize some kinds of e-mail:
* `address_of_string`: could be the most used function, it expects an e-mail
* `set_of_string` & `of_string`: recognizes an e-mail address which could be
bound with a name
* `List.of_string`: recognizes a (optionally named) list of e-mail address _set_

Obviously, all of these functions handle (nested) comments, _folding
whitespace_, and unicode (using `uutf`). About the domains of the parsed e-mail
[RFC5321](https://tools.ietf.org/html/rfc5321#section-4.1.3) so we handle IPv4
and IPv6 domains (using `ipaddr`). We also nicely support old e-mail adresses
(e.g. multiple domains)

As you can see, this library is very young and we need to improve API further.
It was designed to be used in Mr. MIME which is not the better use-case to know
what people really need, so PR are welcome!

PS: this library was propulsed by the #MirageOS hackathon in Marrakech!
```

### OCaml developer position at Be Sport

Vincent Balat announced:
```Be Sport is looking for programmers familiar with functional languages, for a
development and research work.

Send an email to jobs@besport.com if you want to apply!

**The company**
Be Sport is a start-up company with sound funding, with a team of 20 people
today. We have a very ambitious development program and we believe in the use of
modern technologies coming from research to build strong basis for our apps. We
work in close relationship with research laboratories (CNRS, Inria, univ. Paris
Diderot ...). Our main focus at the moment are languages and typing for Web and
mobile apps, recommendation algorithms for social networks, classification
algorithms.
Our first app is a social network dedicated to sport.
Be Sport premises are located in the center of Paris.

**Work**
We are looking for developers to take part in the development of some features
of our apps.
The developers will be integrated in the programming team: participation in the
writing of specifications, implementation (client / server), testing … They will
initially work on improving existing features, before progressively taking the

**Skills**
Good general developers, knowing OCaml or other functional languages (or willing
to learn) are welcome. Other skills related to the implementation of a social
network are also welcome: machine learning, database, search engines, etc.
Candidates must have some expertise on some of the following technologies:
* Typed functional languages, especially OCaml (and Ocsigen Js_of_ocaml/Eliom)
* MacOS, iOS
* Databases
* Machine learning
* Web programming (CSS, Javascript…)
```

### RfP #2: Enhance OCaml Interop with Tcl/Tk

Claude Jager-Rubinson announced:
```A second call for proposals; again, pending funding. The University of
Houston-Downtown is seeking one or more software developers to work on Tcl/Tk
and OCaml interop. There are two distinct tasks here, feel free to apply for one
or both. The first is to implement bindings to the newer Ttk/Tile
widgets/themes. The other is to simplify development and deployment of Tcl
extensions written in OCaml.

The call is available at
http://gator.uhd.edu/~rubinsonc/RfP_OCaml_TclTk_Interop.pdf

Please don't hesitate to contact me with any questions, either here or at
<rubinsonc@uhd.edu>
```

### Other OCaml News

From the ocamlcore planet blog:
```Here are links from many OCaml blogs aggregated at OCaml Planet,
http://ocaml.org/community/planet/.