title: No instance for Control.Monad.Logger.MonadLogger when attempting to use persistent
body: <p>I'm building a web app using <code>scotty</code> and <code>persistent</code> and having some troubles compiling. This is my code:</p>
  
  <pre><code>runDb :: SqlPersist (ResourceT IO) a -&gt; IO a
  runDb query = runResourceT . withSqliteConn "dev.app.sqlite3" . runSqlConn $ query
  
  readMessage :: KeyBackend (PersistEntityBackend Post) Post -&gt; IO (Maybe Post)
  readMessage postID = runDb $ get postID
  </code></pre>
  
  <p>And I get this error message:</p>
  
  <pre><code>Message.hs:30:30:
  No instance for (Control.Monad.Logger.MonadLogger IO)
    arising from a use of `get'
  Possible fix:
    add an instance declaration for
    (Control.Monad.Logger.MonadLogger IO)
  In the second argument of `($)', namely `get postID'
  In the expression: runDb $ get postID
  In an equation for `readMessage':
      readMessage postID = runDb $ get postID
  </code></pre>
  
  <p>I found <a href="https://stackoverflow.com/questions/15448206/yesod-exitfailure-1-when-installing-scaffolded-app">this</a> question, but the accepted answer is use an old version of <code>monad-logger</code> which would also force me to use old versions of many other packages, <code>scotty</code> and <code>persistent</code> included, and I don't want to do that. The other answer recommends using <code>runNoLoggingT</code>, which I was unable to get working. I couldn't figure out where to put it to get it to typecheck.</p>