A Pair of Haskell Libraries

05 Feb 2021

I should start blogging again.

This week I published the first release of two Haskell libraries that fell out of early work I was doing on backup solution for Sandstorm. I’ll write more about the backup project in a later post, but for now, I figured I would write up the two small focused libraries I just pushed out to Hackage.

unix-simple

The first library is unix-simple. This is a fairly straightforward binding to the Posix API; I got frustrated with the spotty nature of the existing unix package and the half dozen supplimentary packages covering less used APIs. I wanted something that mapped to the underlying C APIs in a way that was predictable enough that if you’re familiar with posix you barely need to read the reference docs, and that didn’t have huge gaps in the API that had to be filled in by other, one-off packages.

There is actually a package with some overlapping goals already, posix-api, which at least aims to aggregate APIs into one package, but it still fails on some of my ergonomic criteria.

The README has more information.

lifetimes

The second package, lifetimes, is somewhat more interesting – I was finding resourcet a bit too limited for some of my needs, so I wrote a package for more flexible resource management. resourcet basically lets you define a scope for resources and possibly release them early within that scope. lifetimes is more flexible, in particular:

I plan to supply integration packages for other things in the Haskell ecosystem as well, notably async and my supervisors package.

Cheers.