[Haskell-beginners] Help me make sense of this error

aditya siram aditya.siram at gmail.com
Wed Feb 9 01:06:59 CET 2011


It seems like you're being bitten by precedence rules. Your expression
mapM (...) screenScraping responseBody evaluates like this: (mapM
(...) screenScraping) responseBody. You probably want parentheses
aroung screenScraping responseBody. So something like:
mapM (flip ....) (screenScraping responseBody)
or
mapM (flip ...) $ screenScraping responseBody

On Tue, Feb 8, 2011 at 5:48 PM, Michael Litchard <michael at schmong.org> wrote:
> Here's the three main functions involved. Let me know if I am missing
> pertinent information.
>
>
> I'm having difficulty unraveling this error message. Help?
>
>> obtainCookies :: Curl -> String -> IO ()
>
>> obtainCookies curl responseBody = do
>>                 return $ last $ liftM $
>
>>                    mapM (flip (curlResp2 curl) resourceOpts)
>>                     screenScraping responseBody
>
>
>> screenScraping :: String -> [URLString]
>> screenScraping responseBody =
>>                let collectedStrings = processHTML responseBody
>
>>                    collectedIDLists = createIDList collectedStrings
>>                    in constructedResourceURIs urlBase collectedIDLists
>
>
>> constructedResourceURIs :: String -> [String] -> [URLString]
>> constructedResourceURIs url resourceIDs =
>
>>                         let frontURI = url ++ "/launchWebForward.do?"
>>                             midURI = map (frontURI ++) resourceIDs
>
>>                         in map (++
>> "&policy=0&returnTo=%2FshowWebForwards.do") midURI
>
>
>
>
> HtmlParsing.lhs:81:22:
>     Couldn't match expected type `[URLString]'
>
>            against inferred type `String -> [URLString]'
>     In the second argument of `mapM', namely `screenScraping'
>
>     In the second argument of `($)', namely
>         `mapM
>            (flip (curlResp2 curl) resourceOpts) screenScraping responseBody'
>
>     In the second argument of `($)', namely
>         `liftM
>        $ mapM
>
>            (flip (curlResp2 curl) resourceOpts) screenScraping responseBody'
>
> _______________________________________________
> Beginners mailing list
> Beginners at haskell.org
> http://www.haskell.org/mailman/listinfo/beginners
>
>



More information about the Beginners mailing list