[email protected]
[Top] [All Lists]

[Haskell-cafe] Parse do block problem

Subject: [Haskell-cafe] Parse do block problem
From: joeltt
Date: Mon, 21 Dec 2009 20:14:01 -0800 PST
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: 
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

Haskell-Cafe mailing list
[email protected]

<Prev in Thread] Current Thread [Next in Thread>