requestAndParseResponse client resource parser options text = do
    let uri = buildURI client resource
    let requestBody = urlEncodeVars $ mergeAssocLists options
                [("confidence", "-1"), ("support", "-1"), ("text", text)]
    let contentLength = length requestBody
    let headers = [mkHeader HdrContentType "application/x-www-form-urlencoded"
                  ,mkHeader HdrContentLength (show contentLength)
                  ,mkHeader HdrAccept "text/xml"]
    let request = Request { rqURI = uri, rqMethod = POST, rqHeaders = headers,
                            rqBody = requestBody }
    result <- simpleHTTP request
    case result of
        Left connError -> return $ Left (show connError)
        Right response -> let responseBody = rspBody response in
            case parser responseBody of
                Just sr -> return $ Right sr
                Nothing -> return $ Left responseBody
requestAndParseResponse client resource parser options text = do
    let uri = buildURI client resource
    let requestBody = urlEncodeVars $ mergeAssocLists options
                [("confidence", "-1"), ("support", "-1"), ("text", text)]
    let contentLength = length requestBody
    let headers = [mkHeader HdrContentType "application/x-www-form-urlencoded"
                  ,mkHeader HdrContentLength (show contentLength)
                  ,mkHeader HdrAccept "text/xml"]
    let request = Request { rqURI = uri, rqMethod = POST, rqHeaders = headers,
                            rqBody = requestBody }
    result <- simpleHTTP request
    case result of
        Left connError -> return $ Left (show connError)
        Right response -> let responseBody = rspBody response in
            case parser responseBody of
                Just sr -> return $ Right sr
                Nothing -> return $ Left responseBody
requestAndParseResponse client resource parser options text = do
    let uri = buildURI client resource
    let requestBody = urlEncodeVars $ mergeAssocLists options
                [("confidence", "-1"), ("support", "-1"), ("text", text)]
    let contentLength = length requestBody
    let headers = [mkHeader HdrContentType "application/x-www-form-urlencoded"
                  ,mkHeader HdrContentLength (show contentLength)
                  ,mkHeader HdrAccept "text/xml"]
    let request = Request { rqURI = uri, rqMethod = POST, rqHeaders = headers,
                            rqBody = requestBody }
    result <- simpleHTTP request
    case result of
        Left connError -> return $ Left (show connError)
        Right response -> let responseBody = rspBody response in
            case parser responseBody of
                Just sr -> return $ Right sr
                Nothing -> return $ Left responseBody