[Haskell-beginners] Throughly confused by this error message
Michael Litchard
michael at schmong.org
Thu Jul 7 00:42:15 CEST 2011
I'd like someone to help me learn what questions to ask about this
error. I'm not sure how to contextualize. I will include code segments
that I think are important, and trust your questions will reveal what
I am leaving out.
HtmlParsing.lhs:81:25:
The first argument of ($) takes one argument,
but its type `URLString' has none
In the second argument of `($)', namely `initial $ method_GET'
In a stmt of a 'do' expression:
curlResp curl $ initial $ method_GET
In the expression:
do { let initial = urlInitial urlSequence
login = urlLogin urlSequence
....;
curlResp curl $ initial $ method_GET;
curlResp curl $ urlLogin urlSequence $ loginOpts user pass;
curlResp curl $ urlFlash1 urlSequence resourceOpts;
.... }
> generateResourceHtml :: Curl -> String -> String -> FilePath -> IO (Either String String)
> generateResourceHtml curl user pass ipFile = do
> urlSequence <- popURLrec ipFile
> let makeIDPage = do
> let initial = urlInitial urlSequence
> login = urlLogin urlSequence
> flash1 = urlFlash1 urlSequence
> flash2 = urlFlash2 urlSequence
> showWebForwards = urlShowWebForwards urlSequence
> quickCreate = urlQuickCreate urlSequence
> getResource = urlGetResource urlSequence
> curlResp curl $ initial $ method_GET
> curlResp curl $ urlLogin urlSequence $ loginOpts user pass
> curlResp curl $ urlFlash1 urlSequence resourceOpts
> curlResp curl $ urlFlash2 urlSequence resourceOpts
> curlResp curl $ urlShowWebForwards urlSequence resourceOpts
> curlResp curl $ urlQuickCreate urlSequence resourceOpts
> curlResp curl $ urlGetResource urlSequence resourceOpts
> runErrorT makeIDPage
> data URLSequence = URLSequence { urlInitial :: URLString
> , urlLogin :: URLString
> , urlFlash1 :: URLString
> , urlFlash2 :: URLString
> , urlShowWebForwards :: URLString
> , urlQuickCreate :: URLString
> , urlGetResource :: URLString
> } deriving Show
> curlResp :: (Error e, MonadError e m, MonadIO m) =>
> Curl -> URLString -> [CurlOption] -> m String --CurlResponse
> curlResp curl url opts = do
> resp <- liftIO $ (do_curl_ curl url opts :: IO CurlResponse)
> let code = respCurlCode resp
> status = respStatus resp
> if code /= CurlOK || status /= 200
> then throwError $ strMsg $ "Error: " ++ show code ++ " -- " ++ show status
> else return $ respBody resp
More information about the Beginners
mailing list