[Haskell-beginners] Problem with do statement
Michael Litchard
michael at schmong.org
Sat Jul 2 01:47:03 CEST 2011
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?
More information about the Beginners
mailing list