Here’s a cabal sandbox config file that pins all the package versions required to get Yesod 1.4 to build. You should really use Stack instead. I only did this because I wanted to build Yesod on a system without Stack (long story).
https://github.com/carlohamalainen/playground/tree/master/haskell/yesod-1.4-in-sandbox-quickstart