haskell IO() whats wrong here?
hey i have been doing haskell and with one of my sheets i was asked to do a buildList
i got
buildList :: [String] -> IO ()
buildList thelist = do
putStr "Enter a line: "
str <- getLine
if str == ""
then return ()
else do let list = str:thelist
print list
buildList list
I also had to add a listBuilder :: IO () as well which when ever i try to run I get a weird error
ERROR file:.\week8.hs:92 - Syntax error in input (unexpected `=')
it came to the conclusion that there is something wrong with th开发者_JAVA技巧e buildList, even though it works, as I cant put any new function underneath it, even ones that dont need to use the buildList function
if anyone knows how to fix this, it would be much appreciated. thanks
~tom
Indent the body of the function so the parser knows where it ends.
精彩评论