[Haskell-cafe] ANNOUNCE: Groundhog - high-level database library

Boris Lykah lykahb at gmail.com
Thu Sep 13 20:23:09 CEST 2012

I am happy to announce a new version of Groundhog, a library for fast
high-level database access:

Groundhog has been completely overhauled since the last release.
Notably, it got support for PostgreSQL and natural foreign keys. I
believe that it is a big step forward as this brings more flexibility
to the design of the relational schemas while keeping the applications
independent of the storage layer. Some of the solutions, particularly
schema migration were based on Persistent code.

Please see examples at http://github.com/lykahb/groundhog/tree/master/examples.

* Support for Sqlite and PostgreSQL.
* Natural and composite foreign keys. Earlier it was possible to
reference an entity only by the mandatory integer primary key. Now an
entity can have several keys including autoincrement primary key
(optional) and unique keys which have one or more columns.
* Full support of embedded datatypes. You can access a field that
contains an embedded datatype as a whole, or access some of the inner
subfields individually. This powerful mechanism has allowed
implementation of the composite keys, and can be used in future to
work with PostgreSQL composite types or MongoDB embedded documents.
Instead of serializing value to string, the Groundhog backends flatten
tree of embedded datatypes to db columns.
* Projections. You can choose what columns to query from a table in a
type-safe manner.
* Initialization and migration of database schema.
* Sum types and polymorphic types.
* Expression DSL for use in queries.
* Basic list support.
* YAML-based settings mechanism. It separates datatype definition and
description which facilitates modularity. The settings are inferred
from the analysis of the difinition, and overridden with values set by

The Criterion benchmarks are available at
http://lykahb.github.com/groundhog/SqliteBench.html and

Future plans:
* Support for joins
* Database indexes
* Investigate options for implementing MongoDB and MySQL backends

Your feedback, suggestions for improvement and criticism are welcome.


More information about the Haskell-Cafe mailing list