[Haskell-cafe] Parse do block problem

joeltt joel at harpsoft.com
Mon Dec 21 23:14:01 EST 2009

I'm trying to write my first Haskell program. The below is the first real
logic block I've tried to write, unfortunately I get a "The last statement
in a 'do' construct must be an expression" error when loading the method.
However, the location of this problem isn't very clear. Is there a way to
get more detailed parse message from Haskell, or can someone tell me where
the problem is (and better "why"?). I don't think I actually need to use a
"do" IO/Monad theme here, but its not clear to me either way. This isn't
homework, its just for fun...

    do_solve_iter guess tried = do
                let actual = count_occurences guess
    if guess == actual
       then putStrLn "ANSWER!!"
       else if (find (==actual) tried) == Just actual
           then do
               putStrLn "NO ANSWER!"
               putStrLn tried
           else do
               putStrLn "ITER"
               do_solve_iter actual (actual : tried) 
View this message in context: http://old.nabble.com/Parse-do-block-problem-tp26883702p26883702.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

More information about the Haskell-Cafe mailing list