Performs calculations in database views.

The Haskell layer is modified to use HDBC instead of the persistent
library.