OCaml Weekly News
Hello
Here is the latest OCaml Weekly News, for the week of June 29 to July 06, 2021.
Table of Contents
LibreRef - LablGtk-based Digital Reference Tool Application
Archive: https://discuss.ocaml.org/t/ann-libreref-lablgtk-based-digital-reference-tool-application/8077/1
Kiran Gopinathan announced
I'm not sure if this is that close to the typical uses of OCaml, but posting this here just in case anyone was interested in another end-user facing application using LablGtk.
LibreRef is a free as in freedom digital referencing tool for artists.
It's written in OCaml using LablGtk and Cairo to implement the GUI.
You can find the source code at: gitlab (github mirror)
A picture is worth a thousand words, so before I continue, here are a few examples of it in action:
Overall, getting LablGtk to work was fairly straightforward, although the documentation was a bit lacking (although the same might be said of Gtk itself).
I was able to piece together the correct uses of most of the API calls by relying on either the examples from the repository or by translating snippets of code from online back into LablGtk.
As for deploying it as an application, I found the AppImage & LinuxDeploy toolchain to work well with the resulting binary (admittedly I've only tested it with two devices so far), and it meant that I could publish the program without having to ask people to setup the full OCaml & Opam toolchain, which would probably be a large ask.
As for the implementation, I think it was fairly elegant (if I say so myself :slight_smile:), although I may have gone overboard with functors (see this higher-order functor in the GUI interface: https://gitlab.com/gopiandcode/libre-ref/-/blob/master/gui.mli#L175) and some aspects of the separation of concerns weren't so well established.
u2f - universal second factor
Hannes Mehnert announced
it is our pleasure to announce the just released opam package u2f, which is a server side implementation of the FIDO standard for two-factor authentication using a special device (yubikey etc.). The device does challenge-response authentication with the server using public key cryptography.
The implementation is stateless and does not use a specific IO library, but only achieves the logic for constructing a registration request, verifying a response thereof, and authorization requests with responses thereof. Please have a look at https://github.com/roburio/u2f if you're interested. It is licensed under the permissive 2-clause BSD license.
We use this library in an example server (in the bin
directory) that uses dream. The live server is
online at https://u2f-demo.robur.coop – please let us know if you run into any trouble, or open an
issue on the GitHub repository.
One question though: we're unable to generate the documentation from the mli – already asked on
discord with no result. Anyone with a better understanding of odoc etc. can take a look why dune build @doc
outputs a nearly empty file? Thanks a lot :)
The development was sponsored by skolem.tech.
Reproducible OPAM packages / MirageOS
Hannes Mehnert announced
we are pleased to announce reproducible binary images for MirageOS unikernels (see the blog post at https://hannes.robur.coop/Posts/Deploy). The binaries are located at https://builds.robur.coop (all components are open source and linked from the page).
Additionally, the required tools to achieve reproducible builds are released as binary packages for various operating systems as well on the same site. They are used by the infrastructure to run daily builds (always with the HEAD of opam-repository to not loose any updates / new releases). The custom overlay https://git.robur.io/robur/unikernel-repo is used that adds some development packages.
Happy to hear your thoughts and feedback here. (Earlier post https://discuss.ocaml.org/t/reproducible-builds-with-ocaml-opam-and-mirageos/4877)
This work was funded by the NGI Pointer project "Funding The Next Generation Ecosystem of Internet Architects".
Dune 2.9.0
Emilio Jesús Gallego Arias announced
Dear all, on behalf of the Dune team I'm pleased to announce the release of Dune 2.9.0. This is the last release on the Dune 2.x series and could be considered a maintenance release as it mostly consists on bug fixes and miscellaneous tweaks and features for sites, instrumentation, and mdx support.
Please find the full list of changes below:
- Add
(enabled_if ...)
to(mdx ...)
(https://github.com/ocaml/dune/pull/4434, @emillon) - Add support for instrumentation dependencies (https://github.com/ocaml/dune/pull/4210, fixes https://github.com/ocaml/dune/issues/3983, @nojb)
- Add the possibility to use
locks
with the cram tests stanza (https://github.com/ocaml/dune/pull/4480, @voodoos) - Allow to set up merlin in a variant of the default context (https://github.com/ocaml/dune/pull/4145, @TheLortex, @voodoos)
- Add
(package ...)
to(mdx ...)
(https://github.com/ocaml/dune/pull/4691, fixes https://github.com/ocaml/dune/issues/3756, @emillon) - Handle renaming of
coq.kernel
library tocoq-core.kernel
in Coq 8.14 (https://github.com/ocaml/dune/pull/4713, @proux01) - Fix generation of merlin configuration when using
(include_subdirs unqualified)
on Windows (https://github.com/ocaml/dune/pull/4745, @nojb) - Fix bug for the install of Coq native files when using
(include_subdirs qualified)
(https://github.com/ocaml/dune/pull/4753, @ejgallego) - Allow users to specify install target directories for
doc
andetc
sections. We add new options--docdir
and--etcdir
to both Dune's configure anddune install
command. (https://github.com/ocaml/dune/pull/4744, fixes https://github.com/ocaml/dune/issues/4723, @ejgallego, thanks to @JasonGross for reporting this issue) - Fix issue where Dune would ignore
(env ... (coq (flags ...)))
declarations appearing indune
files (https://github.com/ocaml/dune/pull/4749, fixes https://github.com/ocaml/dune/issues/4566, @ejgallego @rgrinberg) - Disable some warnings on Coq 8.14 and
(lang coq (>= 0.3))
due to the rework of the Coq "native" compilation system (https://github.com/ocaml/dune/pull/4760, @ejgallego) - Fix a bug where instrumentation flags would be added even if the instrumentatation was disabled (@nojb, https://github.com/ocaml/dune/pull/4770)
- Fix https://github.com/ocaml/dune/issues/4682: option
-p
takes now precedence on environement variableDUNE_PROFILE
(https://github.com/ocaml/dune/pull/4730, https://github.com/ocaml/dune/pull/4774, @bobot, reported by @dra27 https://github.com/ocaml/dune/issues/4632) - Fix installation with opam of package with dune sites. The
.install
file is now produced by a localdune install
during the build phase (https://github.com/ocaml/dune/pull/4730, https://github.com/ocaml/dune/pull/4645, @bobot, reported by @kit-ty-kate https://github.com/ocaml/dune/issues/4198) - Fix multiple issues in the sites feature (https://github.com/ocaml/dune/pull/4730, https://github.com/ocaml/dune/pull/4645 @bobot, reported by @Lelio-Brun https://github.com/ocaml/dune/issues/4219, by @Kakadu https://github.com/ocaml/dune/issues/4325, by @toots https://github.com/ocaml/dune/issues/4415)
Hardcaml MIPS CPU Learning Project and Blog
"Alexander (Sasha) Skvortsov announced
Tl;dr: I’m writing a blog about making a MIPS CPU in Hardcaml.
Hi! My name is Sasha, and I’m a student at Penn State majoring in CS and Math. Last semester, I took a computer engineering class where we built a pipelined MIPS CPU in Verilog as a semester-long project. I enjoyed the class, but a lot of frustration came from Verilog itself.
A few months ago, I came across the Signals and Threads Programmable Hardware episode. I really liked the idea of Hardcaml: a library to write and test hardware designs in OCaml. Representing circuits as functions felt like a good abstraction, and I’ve been wanting to learn OCaml for a while.
So this summer, a friend and I are rewriting the Verilog MIPS CPU we made last semester into Hardcaml. We’re still working on the project, but have made some good progress and wanted to share it in case anyone finds it interesting / useful. If anyone wants to take a look, it’s up on GitHub.
We’ve written some blog posts about our project:
- Some more background on what we’re doing and why
- An ELI5 overview of how hardware, and pipelined CPUs in particular, work
- Another high-level overview of Verilog, hardware design, FPGAs, and why I think OCaml might be a great fit for hardware design
- How to set up a Hardcaml project, including testing and Verilog generation
- How to split Hardcaml circuits into multiple modules
There’s also a few more that we’ve written code for, but are still drafting blog posts about:
- How to work with memory in Hardcaml
- How to design stateful, sequential circuits in Hardcaml
- A safer design pattern for Hardcaml circuits
I’m new to both OCaml and blogging, and this has definitely been a fun experience so far! Would love to hear any feedback / comments.
dune-release 1.5.0
Nathan Rebours announced
On behalf of the dune-release team I'm pleased to announce that we're releasing dune-release.1.5.0.
It has been quite a while since the last release so there are numerous changes and improvements in this one, along with a lot of bug fixes.
The two main new features in 1.5.0 are:
- A draft release mode that creates a draft Github release and a draft PR to opam-repository. It comes with an
undraft
command that will undraft both and update the opam file'surl.src
field accordingly. We believe this feature will prove helpful to maintainers of tools such asdune
which releases are often watched by distribution maintainers. Draft releases allow you to wait until you have opam-repository's CI approval to actually create a GH release that will notify anyone watching the repository. This feature is still a bit experimental, we have ideas on how to improve it but we wanted to get a first version out to collect feedback on how it is used and what you folks expect from it. - A
check
command that you can run ahead of a release to know if dune-release has all the information it needs in the repository, along with running the lint, build and test checks it normally runs after building the tarball. We're aware that it can be frustrating to see dune-release fail right in the middle of the release process. We're trying to improve this situation and this is a first step in that direction.
You can see the full changelog here
You'll note we also deprecated a few features such as delegates (as we announced in this
post), opam 1.x and the --user
option and corresponding config file field.
This release is likely to be the last 1.x release of dune-release
except for important bug fixes as
we'll start working on 2.0 soon.
Our main goals for 2.0 are to make the experience for github users as seemless as possible. We want the tool to do the right thing for those users without them having to configure anything. Delegates got in the way there and that's why we're removing them. We do care about our non github users and we've worked on making it as configurable as possible so that you can integrate it in your release workflow. The situation should already have improved quite a bit with this release as we fixed several bugs for non github hosted repositories. We want to make sure that these users will be happy with dune-release 2.0 as well. Hopefully in the future dune-release will support other release workflows such as handling gitlab hosted repositories but we want to make sure our main user base is happy with the tool before adding this.
We'll communicate a bit more on our plans for 2.0 in the next few months. Our hope is that it will hit opam before the end of this year.
We hope that you'll like this new version and wish you all successful and happy releases!
anders 0.7.1
Namdak Tonpa announced
The HTS language proposed by Voevodsky exposes two different presheaf models of type theory: the inner one is homotopy type system presheaf that models HoTT and the outer one is traditional Martin-Löf type system presheaf that models set theory with UIP. The motivation behind this doubling is to have an ability to express semisemplicial types. Theoretical work on merging meta-theoretical and homotopical languages was continued in 2LTT [Anenkov, Capriotti, Kraus, Sattler].
While we are on our road to HTS with Lean-like tactic language, currently we are at the stage of regular cubical (HoTT) type checker with CHM-style primitives, or more general CCHM type checker. You may try it at Github: groupoid/anders.
$ opam install anders $ anders Anders theorem prover [PTS][MLTT][CCHM-4][HTS]. invoke = anders | anders list list = [] | command list command = check filename | lex filename | parse filename | help | cubicaltt filename | girard | trace
Anders is idiomatic and educational. We carefully draw the favourite Lean-compatible syntax to fit 130 LOC in Menhir, the MLTT core (based on Mini-TT) is 500 LOC and pretypes presheaf is another 500 LOC.
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.