title: How to consume a conduit with WAI (raw request body)
body: <p>I'm using scotty, which is a sinatra-like wrapper around WAI. I want to get the raw request body as a byte string so I can parse it as json. The following is close. This is similar to other questions about consuming a body using WAI, but is different because I want the body as a bytestring, and because I'm in a different monad, ActionM</p>
  
  <pre><code>import Network.Wai (requestBody)
  import Web.Scotty (ActionM, request, text)
  
  bodyExample :: ActionM ()
  bodyExample = do
      r &lt;- request
      bss &lt;- requestBody r -- this needs a lift or something
      text "ok"
      ...
  </code></pre>
  
  <p>It obviously won't work, I think I need some kind of lift or something, but I don't know what to use. <code>liftIO</code> isn't right, and <code>lift</code> gives me weird errors. </p>
  
  <p><a href="http://hackage.haskell.org/packages/archive/scotty/0.0.1/doc/html/Web-Scotty.html" rel="nofollow">http://hackage.haskell.org/packages/archive/scotty/0.0.1/doc/html/Web-Scotty.html</a></p>
  
  <p><a href="http://hackage.haskell.org/packages/archive/wai/latest/doc/html/Network-Wai.html" rel="nofollow">http://hackage.haskell.org/packages/archive/wai/latest/doc/html/Network-Wai.html</a></p>