&gt; the majority of my modeling needs to be done in the database and merely wrapped with Haskell<p>I highly recommend Opaleye for this (with the caveat that I&#x27;m the primary author!).<p>From the Opaleye front page:<p>&gt; Opaleye is a Haskell library that provides an SQL-generating embedded domain specific language for targeting Postgres. You need Opaleye if you want to use Haskell to write typesafe and composable code to query a Postgres database.<p>&gt; &quot;Opaleye really is great. You&#x27;ve managed to bring what is so wonderful about relational databases and give it type safety and composition (i.e. what is wonderful about Haskell)&quot; – Daniel Patterson, Position Development<p><a href="https:&#x2F;&#x2F;github.com&#x2F;tomjaguarpaw&#x2F;haskell-opaleye&#x2F;" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;tomjaguarpaw&#x2F;haskell-opaleye&#x2F;</a>