[Haskell-beginners] Problem with do statement
Chaddaï Fouché
chaddai.fouche at gmail.com
Sat Jul 2 09:50:12 CEST 2011
On Sat, Jul 2, 2011 at 1:47 AM, Michael Litchard <michael at schmong.org> wrote:
> 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ï
More information about the Beginners
mailing list