title: Parsec, access last user state after parsing has ended
body: <p>I have a simple parser <code>scriptParser</code>, which uses a user state (type and content not important here). It returns either a <code>String</code> for an error message or a list of <code>Statement</code> (again, not important how this is defined):</p>
  
  <pre><code>parseScript :: String -&gt; Either String [Statement]
  parseScript input
    = let parsed = runParser scriptParser initialUserState "" input
      in  case parsed of
            Left e   -&gt; Left (parseError input e)
            Right ss -&gt; Right ss
  </code></pre>
  
  <p><code>parseError</code> simply formats the error message based on <code>e</code> and <code>input</code> (it shows the snippet of code around the error position).</p>
  
  <p>My question is, what if I'd like to customize the error message also based on the last available user state? Clearly the user state is gone after <code>runParser</code> has ended. Would <code>runParserT</code> allow to access the user state afterwards? </p>