为什么抱怨Haskell解析错误输入`|'在这个函数中? [英] Why complains Haskell parse error on input `|' in this Function?
本文介绍了为什么抱怨Haskell解析错误输入`|'在这个函数中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
makeSets = mSet [] s
其中
m设置堆栈[] = stack
m设置堆栈(x:xs)
|包含堆栈x = mSetstack xs
|否则= mSet(x:stack)xs
其中
包含[] thing = False
包含(x:xs)thing
| x == thing = true
| otherwise = contains xs thing
解决方案 div>
你在混合标签和空格,当缩进非常重要时,这是不好的。使用全部空格(强烈推荐)或全部选项卡。
I was supposed to write a little function in Haskell, which should erase elements, which are twice in the list. Unfortunately, Haskell complains " parse error on input `|' ". Could anyone help me with that?
makeSets=mSet[]s
where
mSet stack []=stack
mSet stack (x:xs)
|contains stack x=mSetstack xs
| otherwise =mSet (x:stack) xs
where
contains [] thing=False
contains (x:xs)thing
| x==thing=True
|otherwise=contains xs thing
解决方案
You are mixing tabs and spaces, which is no good when indentation is significant. Use either all spaces (strongly recommended), or all tabs.
这篇关于为什么抱怨Haskell解析错误输入`|'在这个函数中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文