2

以下函数不进行类型检查的是什么:

import qualified Control.Exception as E
import Data.Conduit (ResourceT)
import Network.HTTP.Types (Method, Status(..))
import Network.HTTP.Conduit
import qualified Data.ByteString.Lazy.Char8 as LBS

doHttps :: Method -> String
        -> Maybe (RequestBody (ResourceT IO))
        -> IO (Either E.SomeException (Response LBS.ByteString))
doHttps reqMethod url body = undefined

它产生以下错误:

RequestBody is applied to too many type arguments
    In the type signature for `doHttps':
      doHttps :: Method
                 -> String
                    -> Maybe (RequestBody (ResourceT IO))
                       -> IO (Either E.SomeException (Response LBS.ByteString))
Failed, modules loaded: none.

doHttps函数是该函数的简化版本。但显然模块类型检查中的原始函数,但上面的代码片段不起作用。为什么会这样?

4

1 回答 1

4

http-conduit 库的不同版本。在版本 1.* 中,RequestBody 接受了一个类型参数:

http://hackage.haskell.org/package/http-conduit-1.9.6/docs/Network-HTTP-Conduit.html#t:RequestBody

但是,在版本 2.* 中,它不接受类型参数:

http://hackage.haskell.org/package/http-conduit-2.0.0/docs/Network-HTTP-Conduit.html#t:RequestBody

于 2014-01-24T09:39:12.243 回答