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

Jason Dagit dagit at codersbase.com
Thu Jul 8 02:58:35 EDT 2010

On Wed, Jul 7, 2010 at 1:16 PM, Michael Snoyman <michael at snoyman.com> wrote:

> * 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.)

If only we had an RDBMS in pure Haskell :)

> * 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.)
> Hmm...yes, partial functions are no fun.  That sounds quite unpleasant.  I
would probably want to make a wrapper that can catch the exception and
returns an Either or Maybe type.

> * 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.

These last two items are reasons to use Takusen.  The left fold enumerator
style of Takusen means that all resource allocation can be controlled by the
library, usually very precisely, and that lazy IO can be avoided.  We did
find one bug in the ODBC backend related to Takusen letting a finalizer run
too soon, but that's fixed in the darcs repo of the Takusen sources.  I've
asked Alistair to release a new version of Takusen with the fix, hopefully
that will happen soon.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100708/991f02d9/attachment.html

More information about the Haskell-Cafe mailing list