Compiler error using IO
Zhanyong Wan
zhanyong.wan@yale.edu
Thu, 3 Jan 2002 19:38:40 -0500
| 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 ()
Haskell uses "layout" to reduce the need for parentheses. For your code to
parse, "if" should align with "res" vertically, as in:
... = do res <- test
if res ...
- Zhanyong