All Posts

Monadic Generators in OCaml

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:

Read more ...


Cohttp Packaging Breakage Ahead

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.

Read more ...


Optional Dependencies Considered Harmful

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.

Read more ...


Searching the load-path

Here’s another tip for taming your Emacs config. In particular, how to search the huge body of elisp that is present with most Emacs installs - the load-path. While the load-path is a very important collection of directories, searching it isn’t as easy and accessible as it should be. As usual, Emacs compensates with plugins:

Read more ...


Spacemacs Useful Buffers Gotcha

I’ve ran into a little spacemacs annoyance that took me a while to resolve, and it seems like it could pop up under a variety of different contexts. I figured that a few words about it here might save others some time.

Read more ...


Pretty Printing a Table in Emacs

Recently, I needed to output some relatively small tabular data in Emacs and message was starting to be a bit long in the tooth. Finally, I’ve decided to try my hand at upgrading the visuals for myself. I realize that there’s probably dozens of different ways of pretty-printing tables in Emacs, but I was already partial to the tabular output used by functions such as list-processes and plugins such as prodigy (Using org mode’s tables also comes to mind for example). So I’ve decided to recreate this experience for my own tables. The result has been convenient and aesthetically pleasing enough to share.

Read more ...


Free Monads in the Wild - OCaml Edition

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.

Read more ...


Publishing an OPAM Package - a Checklist

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:

Read more ...


Scrap your Camlp4

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:

Read more ...


Omegle in N2O

Recently I’ve been messing around with a new and exciting web framework in erlang called N2O. This framework appeals to me for a few reasons. These include:

Read more ...


Type Safe Routing - Baby Steps

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:

Read more ...


Abandoning Async

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.

Read more ...


Introducing Humane-re

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.

Read more ...


Middleware in Opium

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.

Read more ...


Introducing Opium

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:

Read more ...


Omegle clone in Flask + Gevent + WebSockets

Python ranks fairly high when it comes getting things done without too much ceremony in the programming community. I briefly had some doubts of this assertion of until I finally found Flask-Sockets. This small library makes it very natural to serve WebSockets in Flask/gevent. You can consider this blog post as an advertisement for this small but extremely useful library.

Read more ...


Benchmarking OCaml Json Libraries

According to opam OCaml has 2 popular libraries for parsing json:

Read more ...


Document Search Using Cosine Similarity In Haskell Using Linear

Reading OCharles’ excellent series about 24 days of hackage, in particular the post about Linear, I’ve been inspired to revisit some old code I wrote. The code is a document search engine that uses cosine similarity to rank matches. I like the following two articles if you’re not familiar with this technique:

Read more ...


Lru Cache With a Memcache-Like Interface

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.

Read more ...