Previous week Up Next week

Hello

Here is the latest OCaml Weekly News, for the week of July 22 to 29, 2014.

  1. ppx_deriving 0.1
  2. User criteria for dependency solvers
  3. OCaml tutorial in Sweden
  4. ppx_deriving 0.2, ppx_deriving_protobuf 1.0.0
  5. Other OCaml News

ppx_deriving 0.1

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-07/msg00120.html

Peter Zotov announced:
I'm glad to announce an initial release of ppx_deriving,
a modular syntax extension for type-driven code generation.
It will be shortly available in OPAM.

I will introduce ppx_deriving with an example:

# #require "ppx_deriving";;
# type file = {
  kind : [ `File | `Dir ];
  name : string;
  perm : int [@printer fun fmt -> Format.fprintf fmt "0o%03o"];
} [@@deriving Show, Eq];;
type file = { kind : [ `Dir | `File ]; name : bytes; perm : int; }
val pp_file : Format.formatter -> file -> unit = <fun>
val show_file : file -> bytes = <fun>
val equal_file : file -> file -> bool = <fun>
# print_endline (show_file { kind = `Dir; name = "bin"; perm =
0o755 });;
{ kind = `Dir; name = "bin"; perm = 0o755 }
- : unit = ()

A more thorough description is available in README[1].

While I intend this release to primarily serve as a preview for
the community and a means to gather feedback, it is fully usable
and documented. Some of the planned features (marked "TBD" in README)
are not yet implemented.

I hope that ppx_deriving can serve as a future replacement to both
ocsigen's deriving and JaneStreet's type_conv. If you are responsible
for these libraries, please get in touch. The OCaml ecosystem would
benefit from a single type-driven code generation mechanism.

I welcome any comments.

  [1]: https://github.com/whitequark/ppx_deriving/
      
Yotam Barnoy asked and Peter Zotov replied:
> Would it perhaps make sense to generate a
> module per derived type? For example a type t would generate a module
> T_ (the underscore or any other suffix would reduce mixups with
> pre-existing modules). You could then use code such as
>
> 'if T_.(a = b && b = c) ...'
>
> or  'T_.show x ...'
>
> which allows you to keep the infix notation for = which is important
> IMO.
>
> You could even generate T_ as having internal Eq, Ord, and Show
> modules (as requested by the user), which would be included in the T_
> module. This would allow you to easily pass them as first class
> modules to functions accepting Eq, Ord or Show signatures.

I believe this is best left to the upcoming implicits, which will
hopefully be merged soon.

I have based the current design on existing patterns across OCaml
ecosystem; I don't want to change the way people structure their
modules, I want to reduce the amount of boilerplate to write.
      
Yotam Barnoy then asked and Peter Zotov replied:
> Any idea where I can find some info on ocaml's upcoming implicits? A
> google search was not particularly helpful.

There are two articles by Alain Frisch:
http://www.lexifi.com/blog/implicit-values
http://www.lexifi.com/blog/implicit-arguments

They get the general idea across, but do not represent the ongoing work.
The ongoing work is being done in this git repository:
https://github.com/def-lkb/ocaml/commits/implicit-module

As far as I know, it is not yet documented in any way and it is not
clear whether it will be merged in OCaml at all.  However, I have high
hopes for this feature.
      

User criteria for dependency solvers

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-07/msg00136.html

Roberto Di Cosmo announced:
This is a gentle request for comments on the user criteria language accepted by
dependency solvers used by package managers like Opam (see [1] for more details).

You will find in [2] a summary of the current language, with some use cases, and
a few proposed extensions to it.

It would be particularly interesting to have feedback on the expressivity of the
language: if there is some feature that is really missing for some use case you
may have encountered or envisioned, this is the right moment to suggest it.

You may answer off-list, and we'll try to have a final proposal ready for the
OCaml meeting in september

-- 
Roberto

[1] http://www.irill.org/videos/OUPS-2014-07/Meetup_OCaml_package_Managing_Roberto_DiCosmo
[2] http://www.dicosmo.org/Articles/usercriteria.pdf 
      

OCaml tutorial in Sweden

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-07/msg00143.html

Jeremy Yallop announced:
Leo White and I will be giving an OCaml tutorial at this year's CUFP in Sweden.

Where: Gothenburg, Sweden (affiliated with ICFP 2014)
When: September 05, 2014 9:00 AM - 12:30 PM

The tutorial is aimed at people with programming experience, but no
prior knowledge of OCaml is needed.  We'll introduce the basics of
OCaml and then show how to use some of the latest OCaml tools such as
OPAM and IOCaml to build OCaml programs, focusing on the construction
of a simple game.

You can find more details on the CUFP site:

   http://cufp.org/2014/t7-leo-white-introduction-to-ocaml.html

You can register here:

   https://regmaster4.com/2014conf/ICFP14/register.php

Note the deadline for (discounted) early registration: 3rd August 2014.

Hope to see you there!
      

ppx_deriving 0.2, ppx_deriving_protobuf 1.0.0

Archive: https://sympa.inria.fr/sympa/arc/caml-list/2014-07/msg00161.html

Peter Zotov announced:
I'm glad to announce the releases of ppx_deriving and
ppx_deriving_protobuf (ex ppx_protobuf).

ppx_deriving
============

_deriving_ is a library simplifying type-driven code generation on
OCaml >=4.02.[1]

0.2
---

  * New plugins: Enum, Iter, Map, Fold.
  * All plugins: don't concatenate affix if type is named `t`.
  * Add [%derive.Foo:] shorthand.
  * Show, Eq, Ord: add support for list, array, option.
  * Show: include full module path in output, including for types with
manifest.
  * A lot of changes in Ppx_deriving interface.

ppx_deriving_protobuf
=====================

_deriving Protobuf_ is a _deriving_ plugin  that generates
Google Protocol Buffers serializers and deserializes.[2]

1.0.0
-----

  * First stable release and initial release as _deriving Protobuf_.

[1]: https://github.com/whitequark/ppx_deriving
[2]: https://github.com/whitequark/ppx_deriving_protobuf
      

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/.

My first unikernel:
  http://roscidus.com/blog/blog/2014/07/28/my-first-unikernel/

Full Time: Software Developer (Functional Programming) at Jane Street in New York, NY; London, UK; Hong Kong:
  http://jobs.github.com/positions/0a9333c4-71da-11e0-9ac7-692793c00b45

Release of OCaml-safepass 1.3:
  https://forge.ocamlcore.org/forum/forum.php?forum_id=906

Cartesian product (redux):
  http://shayne-fletcher.blogspot.com/2014/07/cartesian-product-redux.html

Doing Nothing in Mirage:
  http://www.somerandomidiot.com/blog/2014/07/25/doing-nothing-in-mirage/

Seventh OCaml compiler hacking session (at Citrix):
  http://ocamllabs.github.com/compiler-hacking/2014/07/24/compiler-hacking-at-citrix.html

libguestfs now works on 64 bit ARM:
  http://rwmj.wordpress.com/2014/07/23/libguestfs-now-works-on-64-bit-arm/
      

Old cwn

If you happen to miss a CWN, you can send me a message and I'll mail it to you, or go take a look at the archive or the RSS feed of the archives.

If you also wish to receive it every week by mail, you may subscribe online.


Alan Schmitt