Haskell - 输入分析错误`=' [英] Haskell - parse error on input `='

查看:309
本文介绍了Haskell - 输入分析错误`='的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在执行河内塔问题时,我收到以下错误消息:

when implementing the code for the "Towers of Hanoi" problem I get the following error message:

hanoi.hs:4:24: parse error on input `='
Failed, modules loaded: none.






以下是代码:


Here is the code:

hanoi 1 i j = [(i, j)]
hanoi n i j = hanoi n' i otherT ++ [(i,j)] ++ hanoi n' otherT j
    where   n' = n-1
            otherT = 1+2+3-i-j






任何想法?


Any Ideas?

推荐答案

你的编辑器和编译器以不同的方式查看这些标签避免使用制表符并用空格缩进:

Your editor and the compiler see the tabs differently. Avoid using tabs and indent with spaces:

hanoi 1 i j = [(i, j)]
hanoi n i j = hanoi n' i otherT ++ [(i,j)] ++ hanoi n' otherT j
    where   n' = n-1
            otherT = 1+2+3-i-j

良好的编辑器可以设置为在您按下标签页时自动输入正确数量的空格。

Good editors can be set up to do the right number of spaces automatically when you press tab.

这篇关于Haskell - 输入分析错误`='的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆