The HaskellDB library lets you generate SQL queries without writing
any actual SQL. Unlike other query generating libraries, you choose
the abstraction level. Queries can be built out of independent
fragments, just like your programs. Leave hand-written, string-based,
SQL libraries behind and check out HaskellDB.
* New query capabilities: stored procedures, CASTs, query
parameters, constants, and more.
* Postgres SQL improvements.
* Bug fixes around AND and OR associativity.
* Query optimization improvements around aggregate expressions.
* More tests.
Back in June 2009, Bjorn Bringert passed maintainership of HaskellDB
to me. I've been working this summer to get a release out, which
* Adding an examples/ directory to the source distribution.
* Archiving and consolidating information to
* Accepting patches for various issues.
I have used a lot of ORM & SQL-wrapper libraries during my career and
HaskellDB is the first that I've found which does not require you to
eventually break the abstraction.
Learning to use the the library was a fun challenge but not one that
many people are willing to take, when they can easily write SQL by
hand. If the library was easier to get started with, I think it would
be much more widely used. Help me get HaskellDB better documentation!
If you are using HaskellDB and want to help: go to
http://trac.haskell.org/haskelldb and write an article, write a blog
post, get in touch with me, etc. When I saw that Rails 3.0 uses the
"ARel" gem (based on the relational algebra) I groaned - Haskell has
had that forever! We need to get the word out!
Last year Brian Bloniarz contributed an awesome patch which replaced
HaskellDB's home-grown record system with the HList library by Oleg
Kiselyov (and colleagues). I intended to work with the library for
awhile and get a 1.0 release out.
Unfortunately, HList proved too daunting for GHC and for me. Compile
times went way up, and I could not isolate it enough to give GHC HQ a
repro case. Even worse, HList required too many Oleg units for me to
comprehend. I could usually fix compile errors, but found myself
struggling to extend HaskellDB's functionality. In the end I felt I
needed to back the patch out. I really hated to lose some of the
functionality but in the end maintainability won out. At that point I
had pushed a few patches with a v1.0 cabal file, so I thought it best
to make this release 2.0.
Who am I?
I started using HaskellDB in early 2009. I use it more as a
query-generating library than for executing SQL statements. I have
written a largish system for generating a data-access layer in PHP
from query descriptions in HaskellDB. Yes, I'm using Haskell to write
PHP ... dirty!
A couple of haskelldb related packages on Hackage are not maintained by me:
* haskelldb-hdbc-mysql - This project was created and uploaded
independent of me. Contact the author for specifics. However, the
haskelldb-hdbc-odbc library is maintained by me and can be used to
talk to MySQL.
* HSQL (haskelldb-hsql, etc) - I cannot get this backend to compile
on my platform. HSQL seems unmaintained so I have let the drivers
decay. You'll notice I have not uploaded new packages or changed their
* haskelldb-flat and haskelldb-dynamic - Both of these packages have
suffered serious bitrot and are not maintained any longer.
Haskell-Cafe mailing list
[hidden email] http://www.haskell.org/mailman/listinfo/haskell-cafe
> Great work!
> I think I'm going to use it.
> Any plan on packaging up Christopher Done's HaskellDB's type operators:
> http://chrisdone.com/posts/2010-10-07-haskelldb-and-typeoperator-madness.html >
> Which allows you to write something like:
> type PersonTable = Table :$: Expr
> :%: Id ::: Integer
> :+: Age ::: Integer
> :+: Email ::: String
> :+: Blurb ::: Maybe String
> :+: End
Re: [Haskelldb-users] ANNOUNCE: HaskellDB 2.0: Scrap your SQL strings
On 11 October 2010 16:45, Justin Bailey <[hidden email]> wrote:
> No immediate plans but thanks for pointing that out - I hadn't seen it
> yet. Similar functionality exists in the haskelldb-th package, without
> the special type operators.
You mentioned that haskelldb was the first library where you weren't
forced to break the abstraction. Do you have a solution to a situation
where you might want to retreive the last inserted id after an insert?
Re: ANNOUNCE: HaskellDB 2.0: Scrap your SQL strings
On 21 February 2012 11:51, Mats Rauhala <[hidden email]> wrote:
> You mentioned that haskelldb was the first library where you weren't
> forced to break the abstraction. Do you have a solution to a situation
> where you might want to retrieve the last inserted id after an insert?
That's a case where I would consider modifying
haskelldb-hdbc-postgresql, for example, to export an insertReturningId
or whatever, because some other engines don't support returning an ID,
and it wouldn't make sense to return Maybe Int or error for the ones
that don't support it. This way it's well-typed.