[web-devel] Upgrading from WAI 1.4.1 to 2.0.0, Monad / ResourceT issues

Leif Warner abimelech at gmail.com
Sun Dec 8 19:44:52 UTC 2013


Trying to upgrade this code from WAI 1.4.1 to 2.0.0.  On one hand, I don't
have to liftIO the IO action on line 23 anymore.  On the other, this line
that writes the request body to a file seems to be giving me some trouble
now:
https://github.com/LeifW/online-typechecker/blob/master/index.hs#L22

    No instance for (MonadResource IO) arising from a use of `sinkFile'
    Possible fix: add an instance declaration for (MonadResource IO)
    In the second argument of `($$)', namely
      `sinkFile ("sources" </> fromText name)'
    In a stmt of a 'do' block:
      requestBody req $$ sinkFile ("sources" </> fromText name)

If I put a "runResouceT" in front of that, like "runResourceT $ requestBody
req $$ sinkFile ("sources" </> fromText name)", I get

    Couldn't match type `IO' with `ResourceT IO'
    Expected type: Data.Conduit.Internal.Source
                     (ResourceT IO) Data.ByteString.Internal.ByteString
      Actual type: Data.Conduit.Internal.Source
                     IO Data.ByteString.Internal.ByteString
    In the return type of a call of `requestBody'
    In the first argument of `($$)', namely `requestBody req'
    In the second argument of `($)', namely
      `requestBody req $$ sinkFile ("sources" </> fromText name)'

Any pointers?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/web-devel/attachments/20131208/8715e068/attachment.html>


More information about the web-devel mailing list