I wonder if this concept is easily translatable to SQL servers. I would use such a library, especially if it could be easily layered on top of (or integrated with) the standard MySQL and Postgres libraries.
You would need a formal algebra for SQL. At one time SQL was built on a consistent formal model, but these days I suspect it would be a lot of effort to make any real implementation match up with a formal model. You would also need to express the queries in the same formalism (i.e. not just strings). In terms of the driver you could do it by having some kind of F[_]-wrapper in the return type (I think) which would be a nice feature (you can abstract over async-or-not in the same way) but I don’t think any existing drivers do that.