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:
- haskell-haskelldb
- haskell-haskelldb-hdbc
- haskelldb-hdbc-sqlite3
- haskelldb-hdbc-postgresql
- haskelldb-hdbc-odbc
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:
- High level: haskelldb, Takusen
- “Normal” level: HDBC, hsql
- 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 | |
haskelldb | ✕ | ✕ | ✕ | 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.