haskell IO() 这里出了什么问题?
嘿,我一直在做 haskell,并且在我的一张表中,我被要求做一个 buildList,
我得到了
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
,我还必须添加一个 listBuilder :: IO () ,每当我尝试运行时,我都会收到一个奇怪的
ERROR file:.\week8.hs:92 - Syntax error in input (unexpected `=')
错误结论是 buildList 有问题,即使它有效,因为我不能在它下面放置任何新函数,即使是不需要使用 buildList 函数的函数,
如果有人知道如何解决这个问题,我将不胜感激。谢谢
〜汤姆
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 the 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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
缩进函数体,以便解析器知道它在哪里结束。
Indent the body of the function so the parser knows where it ends.