haskelldb: high level, type safe database queries for Haskell

The venerable haskelldb high level database interface for Haskell is now packaged up for Arch.

HaskellDB is a combinator library for expressing queries and other operations on relational databases in a type safe and declarative way. All the queries and operations are completely expressed within Haskell, no embedded (SQL) commands are needed.

The code base is around a decade now, and quite mature, but it has only recently been brought into the cabal and hackage world, making it trivial to package up and distribute. You can find all the packages here:

This release of haskelldb is layered over medium-level database interface suite, hdbc., so it can reuse the hdbc backends. The layers of Haskell database libs packaged up looks something like:

  1. High level: haskelldb, Takusen
  2. “Normal” level: HDBC, hsql
  3. Low level: sqlite, anydbm, hsSqlite3, PostgreSQL, BerkeleyDB

Low level ones typically just wrap the C interfaces underneath, providing few new safety guarantees. Medium level ones generally present a “sensible” Haskell API to the exposed db libraries, while the high level ones attempt to abstract out significant safety or productivity by embedding concepts deeper into the language.

Different libraries support different C backends, I’ll attempt to break that down here:

mysql postgres sqlite odbc oracle notes
hdbc Documented in RWH
High level
takusen Chooses backend(s) via compile time flag
hsql ? ? Less active?

Also of note is haskell-couchdb , and even haskell-hs3, for a different storage needs.

Finally, if you want to step away from calling out  to C altogether, and go for something purely in Haskell, there’s haskell-tcache, a transactional cache with configurable persistence in 100% Haskell using transactional memory.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s