Haskell,我无法摆脱可能的缩进错误
我有一个问题,无法找出它是什么。我一遍又一遍地重新缩进,但找不到解决方案。这还有什么可以依赖的吗?
代码:
type Triple = (Prime, Quot, Gen)
correctness :: Triple -> Bool
correctness (p,q,g) = prime && pLength && qLength && divisor && orderq
where prime = probablyPrime n 5
qLength = q < 2^1024
pLength = p < 2^160
divisor = (p-1 `mod` q) == 0
orderq = (g^q mod p == 1) && (g > 1)
错误消息(第 94 行对应于“正确性 :: Triple -> Bool”):
crypt.hs:94:0: parse error (possibly incorrect indentation)
编辑:我解决了问题。问题是上述函数中的语法错误。我有 otherwise m_ify m*2
而不是 otherwise = m_ify m*2
I have a problem and cannot find out what it is. I have reindented again over and over, but cannot find the solution. Is there something else this can be dependent on?
Code:
type Triple = (Prime, Quot, Gen)
correctness :: Triple -> Bool
correctness (p,q,g) = prime && pLength && qLength && divisor && orderq
where prime = probablyPrime n 5
qLength = q < 2^1024
pLength = p < 2^160
divisor = (p-1 `mod` q) == 0
orderq = (g^q mod p == 1) && (g > 1)
Error Message (line 94 corresponds to "correctness :: Triple -> Bool"):
crypt.hs:94:0: parse error (possibly incorrect indentation)
EDIT: I solved the problem. The problem was a syntax error in an above function. I had otherwise m_ify m*2
instead of otherwise = m_ify m*2
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可能只需要在最后一行的
mod
周围添加反引号即可。这不会导致您报告的缩进错误,但以下内容会为我编译:这里唯一的更改(除了前五行)是在最后一行。
You might just need to add backticks around the
mod
in the final line. This wouldn't cause the indentation error you report, but the following compiles for me:The only change here (apart from the first five lines) is in the last line.
Worksforme,直接跳到类型错误。
是第 92 行
,还是你从其他地方移过来的?有时,错误显示的行号可能晚于实际发生的位置。我会检查第 92 行上方(可能在附近)是否有不匹配的括号。
在某些情况下,一个不可见的 unicode 字符似乎会潜入我的代码中。重新输入有时会起作用。
Worksforme, jumps right into the type errors.
Is line 92 the
line, or did you move that from somewhere else? Sometimes errors can show up with a line number later than where they actually occur. I would check for mismatched parentheses above line 92 (probably nearby).
And on some occasions an invisible unicode character seems to sneak into my code. Retyping has occasionally worked.
尝试:
阅读 - http://www.haskell.org/onlinereport/syntax-iso.html 9.3 布局
Try:
Read - http://www.haskell.org/onlinereport/syntax-iso.html - 9.3 Layout