Posts tagged OCaml
Deriving Slowly
- 20 August 2019
There’s been some recent grumbling about the usability of ppx in OCaml, and
instead of just letting it slide again, I’ve decided to do something
constructive about this and write a little tutorial on how to write a
deriving
plugin.
Virtual Libraries
- 19 December 2018
Last week I finally managed to slog through the last remaining issues required to implement Virtual Libraries, and since it’s quite a milestone (slated for dune 1.7), I’d like to share my excitement for this feature. The feature itself is nothing new to old timers, but I think that dune now manages to present it in a much more polished way. Besides, OCaml is enjoying a recent uptick of new users, so perhaps a little review might be useful. I find that it is always helpful to have at least a high level understanding of how a build feature works to use it effectively.
Extension Points - Ppxlib & Dune Update
- 05 August 2018
In a previous post, I’ve described what are the latest technologies used to construct and package ppx rewriters. In just eight months a couple important changes have occurred that require ppx authors to react. In this post, I’d like to describe these changes and demonstrate how to update your ppx rewriters to keep up with them.
What’s coming in Dune 1.1.0?
- 02 August 2018
Now that 1.0.0 has been released, the team took a break from dune affairs. However, now we’re back to work, and although we’re working at a more relaxed pace, we still have some interesting features in store. Most of these were already planned for quite a while, but simply had to be delayed to get 1.0.0 out of the door. Hopefully this post convinces the reader that it was worth the wait.
Configurator Reborn
- 12 June 2018
With dune 1.0 around the corner, there’s a pressing need to create some hype raise awareness of the upcoming features. In this post, I’d like to talk about one such transition: the move to dune’s own configuration kit called configurator. Since the library itself is still fairly new, I’ll first introduce configurator itself and show what problems it attempts to solve.
jbuilder (dune) Beta 17
- 23 January 2018
The 17th beta of jbuilder represents a few months of development. While that’s a bit longer than our usual release cycle for these betas, we do have a larger release than usual. So I’ve decided to write up a little post in addition to just posting the usual change log. I’ll talk about some important new features, and some less important ones as well. A couple of things that I’ll omit are bug fixes and experimental features as this blog post is already long.
Extension Points - 3 Years Later
- 04 December 2017
UPDATE: 2017-12-05 smondet pointed out that the extension doesn’t work quite as the original. ppx_getenv should fetch the environment variable at compile time rather than at runtime. The extension and the snippets in this post have been updated to reflect this.
Creating Static Linux Binaries in OCaml
- 03 November 2017
Creating truly static binaries for Linux like golang is a capability that is occasionally useful. I’ve seen questions about it on IRC a few times, and I’ve personally found this approach is particularly useful when deploying to environments where installing libraries isn’t easy, such as AWS Lambda. Unfortunately for me, the approach that I will explain in this article wasn’t as approachable. So I’ve prepared a quick tutorial on how to easily create a static binary in OCaml and test it.
Monadic Generators in OCaml
- 25 July 2017
Generators are one of those features that have been heavily popularized by today’s fashionable languages such as Python and ES6. So it’s not the first time I’ve encountered programmers who are curious about OCaml bring up with questions along the lines of:
Cohttp Packaging Breakage Ahead
- 14 May 2017
As a follow up to my previous post regarding optional dependencies, I’d like to expand on how my advice will be followed in practice in the context of the cohttp library.
Optional Dependencies Considered Harmful
- 22 April 2017
This will be a short PSA to opam package maintainers to avoid spurious optional dependencies. At this point, I think this is all relatively common knowledge. But open source maintainers are as a rule busy people, and without much encouragement, they end up dragging their feet. Therefore I hope this post can be a useful reminder of the negative effects of optional dependencies and what can be done to avoid them.
Free Monads in the Wild - OCaml Edition
- 22 July 2016
OCaml programmers don’t seem to resort to free monads much. I like to imagine that this is the case because we’re a practical bunch. But it could simply be that this technique like other monads is a bit heavyweight syntactically, let alone the performance implications it might have.
Publishing an OPAM Package - a Checklist
- 26 February 2016
The process of publishing an opam package has come a long way from its modest beginnings. Nevertheless the opam team deserves praise for choosing an extremely simple and flexible model for contribution - the git commit. To me that explains how it aged gracefully with improvements such as:
Scrap your Camlp4
- 15 February 2016
ppx has been out for a while but it seems like the community has been taking its time transitioning away from camlp4. There’s probably a couple of reasons for that:
Type Safe Routing - Baby Steps
- 13 December 2014
Type safe routing means different things to different people. So let’s start by clarifying the intended meaning in this post. There are 2 widely used definitions:
Abandoning Async
- 11 December 2014
There is an old and great schism in the OCaml community. The schism is between two concurrency libraries - Async and Lwt. As usual for these things, the two are very similar, and outsiders would wonder what the big deal is about. The fundamental problem of course is that they’re mutually incompatible. The result of this is a split OCaml world with almost no interoperability, and duplication of efforts.
Introducing Humane-re
- 23 May 2014
OCaml is my favorite language, but one area where it (its tools rather) often falls short in practice is common string handling tasks where regular expressions are often involved. The kind of stuff that Awk and and scripting languages often get praised for. In other words, not getting in the way and allowing to get the job done with minimal boilerplate.
Middleware in Opium
- 11 April 2014
In my previous post I’ve introduced opium in a beginner friendly way, while in this post I’ll try to show something that’s a little more interesting to experienced OCaml programmers or those are well versed with protocols such as Rack, WSGI, Ring, from Ruby, Python, Clojure respectively.
Introducing Opium
- 04 April 2014
One itch that I usually need to scratch is setting up quick and dirty REST API’s - preferably in OCaml. OCaml does have a few options for web development but I found them to be not so great fits for my needs. To summarize:
Benchmarking OCaml Json Libraries
- 05 February 2014
According to opam OCaml has 2 popular libraries for parsing json:
Lru Cache With a Memcache-Like Interface
- 10 December 2013
Lately, I’ve been messing around with Janestreet’s core and async libraries by reimplementing an old interview question that has been posed to me before. The problem statement itself is from my memory alone so this isn’t 100% what I’ve been asked but it should be extremely close.