Compiler error using IO

Tom Bevan tom@regex.com.au
04 Jan 2002 11:32:23 +1100


When trying to right IO I continually run across this
sort of compile error which I just don't understand.
Any help would be very muich appreciated.

Function:


while :: IO Bool -> IO () -> IO ()

while test action = do res <- test
                        if res  then do action
                                        while test action
                                else return ()

Error:

io.hs: 112 lines, 2463 characters.
Reading file "io.hs":
Parsing
ERROR io.hs:110 - Last generator in do {...} must be an expression


Tom