Pergunta

What doesn't the following function doesn't typecheck:

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

It produces the following error:

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.

The doHttps function is a simplified version of this function. But apparently the original function in the module typechecks, but the above snippet doesn't work. Why does this happen ?

Foi útil?

Solução

Different versions of the http-conduit library. In version 1.*, RequestBody took a type argument:

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

However, in version 2.*, it does not take a type argument:

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top