OCaml Weekly News

Previous Week Up Next Week

Hello

Here is the latest OCaml Weekly News, for the week of March 28 to April 04, 2023.

Table of Contents

OCaml-css 0.1.0

Zoggy announced

I’m pleased to announce the first release of OCaml-css, a library to parse and print CSS. It can also expand namespaces and perform computations on property values.

Parsing uses Angstrom to dynamically choose the parser when encountering a property declaration. Not all properties are handled yet but the parser can be extended by defining additional properties. Some shorthand properties are handled too. Some ~@rule~s are not handled by now, they are parsed and returned as strings, with a warning in log.

The css package should be available soon in opam.

Bogue tutorials 0.1.0

sanette announced

Hi, I’m pleased to announce an ongoing series of tutorials for Bogue (the Desktop GUI library for OCaml):

https://github.com/sanette/bogue-tutorials

So far only three are written:

More will come when time permits!

Each tutorial includes code that can either be pasted onto a toplevel, or automatically executed (the executables are shipped in the ocaml-tutorials opam package.

Feedback appreciated! (hopefully constructive ;) )

Embedded Ocaml Templates 0.8

Emile Trotignon announced

I am quite happy to announce the release of EML 0.8. EML is a simple templating language that lets you generate text with plain OCaml. It is analogous to the way you would write PHP pages, but the language being Ocaml instead.

There are two ways of using it, the first one is in a standalone file, for instance resume.eml.tex :

<%# firstname lastname email birthdate phonenumber formations %>
\documentclass[10pt, a4paper, roman, french]{moderncv}
\usepackage{babel}
\firstname{ <%-firstname%> }
\familyname{ <%-lastname%> }
\mobile{<%- phonenumber%>}
\extrainfo{Born <%-birthdate%> }
\email{ <%-email%> }
\begin{document}
	\makecvtitle
	\section{Formation}
	 <% List.iteri (fun i (date_start, date_end, diploma, school) ->%>
		\cventry{ <%i- i %> <%-date_start%> -- <%-date_end%>}{<%-diploma%>}{<%-school%>}{}{}{}
	 <%) formations ;%>
\end{document}

There is also support for compiling a whole recursive directory of templating files with a single dune rule.

The other one would be in OCaml code with a PPX :

let resume  firstname lastname email birthdate phonenumber formations =
  {%eml|
\documentclass[10pt, a4paper, roman, french]{moderncv}
\usepackage{babel}
\firstname{ <%-firstname%> }
\familyname{ <%-lastname%> }
\mobile{<%- phonenumber%>}
\extrainfo{Born <%-birthdate%> }
\email{ <%-email%> }
\begin{document}
    \makecvtitle
    \section{Formation}
     <% List.iteri (fun i (date_start, date_end, diploma, school) ->%>
        \cventry{ <%i- i %> <%-date_start%> -- <%-date_end%>}{<%-diploma%>}{<%-school%>}{}{}{}
     <% ) formations ;%>
\end{document}
|}

The ppx is also suitable for simple string interpolation.

A similar templating and homonymous templating engine is present in the Dream framework. Dream.EML has a slightly different syntax, mine is less geared toward HTML and more suitable for general templating. Dream also does not support compiling multiple templates with a single dune rule.

In 0.8, the locations in the PPX are finally correct. This means that type errors will show up in their correct place, which is very nice (once a small bugfix in merlin is merged (the error message is still correct)). I also got rid of a depency on Menhir.

It is available on opam as the embedded_ocaml_templates package, and the doc is here

Available for Hire - Q2+3+4 2023

Sabine Schmaltz announced

Here’s a thread to announce your availability as an OCaml developer looking for an OCaml job. :rocket:

Freelancers, contractors and job-seekers, do advertise your services and experience here.

Since the volume on these threads is still fairly low, let’s go with one thread for the rest of 2023 that I will bump every quarter.

editor’s note: please follow the link above to see the replies to this thread.

Format strings and the OCaml compiler error messages

octachron announced

I am currently trying my hand at writing down my weekly activity on the OCaml compiler as blog post on the Cambium team blog:

http://gallium.inria.fr/blog/florian-weekly-2023-04-03

This week the main and only topics is some ongoing work on mine on an alternative handling for partial error messages in the compiler. The medium-term objective is to move slowly towards machine-readable error message by making that all the type used in error report internally in the compiler are serializable. This has lead towards a fun path of implementing an alternative format string interpreter that you can see in action at https://github.com/Octachron/format-doc .

Other OCaml News

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.