Building blocks for custom Haskell databases