title: Manipulating the monad stack
body: <p>If I have a stack of monads, say <code>IO</code>, <code>State</code> and <code>Error</code>, and a function that only uses <code>IO</code> and <code>Error</code>.  How would one go about "removing" the middle <code>State</code> monad from the stack so I can use my function?  If the order was <code>IO</code>, <code>Error</code>, <code>State</code>, I could use <code>lift</code> to match the types, but I want to be able to use my function if the monad stack contains <code>IO</code> and <code>Error</code> and possibly other monads in whatever order.  For example:</p>
  
  <pre><code>fun :: ErrorT String IO ()
  fun = throwError "error"
  
  someCode :: ErrorT String (StateT Int IO) ()
  someCode = do
      -- I want to use fun here
  </code></pre>