Some frameworks provide automatically generated type-safe entities, query, and update capabilites, such as the Yesod Persistent framework [0].
For a smaller but similarly safe approach, I reccomend Esqueleto.
[0] http://www.yesodweb.com/book/persistent [1] https://hackage.haskell.org/package/esqueleto