
I received an error message that might be due to indentation, and not what the error message claims. Here's the error, then the code. Below that I have some comments. ghc --make CreateSession.lhs [2 of 3] Compiling HtmlParsing ( HtmlParsing.lhs, HtmlParsing.o ) HtmlParsing.lhs:81:5: The last statement in a 'do' construct must be an expression: let makeIDPage = do { initial }
generateResourceHtml :: Curl -> String -> String -> FilePath -> IO (Either String String) generateResourceHtml curl user pass ipFile = do urlSequence <- popURLrec ipFile let makeIDPage = do 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
It seems to me the first do construct ends with a statement, runErrorT makeIDPage. Also the second do construct ends with a statement as well,
curlResp curl $ urlGetResource urlSequence resourceOpts
So I'm either wrong about what the definition of a statement is, or this problem is really about indentation or similar. Clarification?

On Sat, Jul 2, 2011 at 1:47 AM, Michael Litchard
I received an error message that might be due to indentation, and not what the error message claims.
Here's the error, then the code. Below that I have some comments.
ghc --make CreateSession.lhs [2 of 3] Compiling HtmlParsing ( HtmlParsing.lhs, HtmlParsing.o )
HtmlParsing.lhs:81:5: The last statement in a 'do' construct must be an expression: let makeIDPage = do { initial }
generateResourceHtml :: Curl -> String -> String -> FilePath -> IO (Either String String) generateResourceHtml curl user pass ipFile = do urlSequence <- popURLrec ipFile let makeIDPage = do initial = urlInitial urlSequence login = urlLogin urlSequence
you can't write "initial = url..." directly in a do construct. You have to introduce any definition with a let. Here Haskell read it "makeIDPage = (do initial) = urlInitial urlSequence...'" which doesn't make sense at all. -- Jedaï
participants (2)
-
Chaddaï Fouché
-
Michael Litchard