[Haskell-cafe] Merge hsql and HDBC -- there can only be one!

Michael Snoyman michael at snoyman.com
Wed Jul 7 16:16:17 EDT 2010

On Wed, Jul 7, 2010 at 9:46 PM, Jonathan Daugherty <drcygnus at gmail.com>wrote:

> > Anyway, the point remains, we need a single goto database library.
> >
> > Though the lack of response to this thread makes me think no one
> > particularly thinks this is a problem.
> This is an interesting problem.  For my part, I suspect the
> proliferation of high-level database libraries is going to continue.
> If you were to convince the present package maintainers to pitch in
> and build a Grand Database Library, inevitably someone would come
> along and build another one for whatever reason.  Also, I don't think
> the dust has settled on techniques for database access in Haskell in
> any case, even for RDBMSs in particular.
> For what it's worth, I would be happy to get persistent[1] behind a Grand
Database Library. Right now, the PostgreSQL backend[2] is built on HDBC
while the SQLite backend[3] includes a variant of the direct-sqlite
package[4]. Here's my two cents on why I didn't run with HDBC for both:

* I wanted the SQLite backend to be the default backend that anyone could
use, without library dependencies. It would be nice if HDBC-sqlite3 had an
option to build against the sqlite3 amalgamation instead of system
libraries. (In fact, it would be cool if that were the default, and system
libraries the option.)

* I'm not fond of the Convertible typeclass. In particular, it makes no
distinction between conversions which are guaranteed to succeed (Int ->
String) and conversions which might fail (String -> Int). As a result, the
fromSql function can easily throw a runtime error. (For that matter, toSql
could as well, but that is much less likely.)

* I would like to be able to explicitly finalize statements. I believe I've
gotten some exceptions in the past when trying to close a database
connection because some statements were not finalized, but I can't remember
the details right now.

* I don't like that the lazy versions of functions are the default, and you
have to add the ' for strict. It's too easy to make mistakes with the
results of a lazy database query. I would even go so far as to recommend
removing them entirely, but I think most people will not like that.

Overall, I think HDBC is a great library, but I have no experience with the

The idea of breaking things into low-level C bindings and higher-level stuff
on top is great.


[1] http://hackage.haskell.org/package/persistent
[2] http://hackage.haskell.org/package/persistent-postgresql
[3] http://hackage.haskell.org/package/persistent-sqlite
[4] http://hackage.haskell.org/package/direct-sqlite
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100707/93ceb100/attachment.html

More information about the Haskell-Cafe mailing list