简体   繁体   English

Agda 中缺少类型签名错误,我不知道如何避免

[英]A missing type signature error in Agda which I do not know how to avoid

I have the following code in a file trial_agda.agda in emacs:我在 emacs 的文件trial_agda.agda中有以下代码:

module trial_agda where

data 𝕟 : Set where
 zero : 𝕟
 suc  : 𝕟 → 𝕟
 _+_ : 𝕟 → 𝕟 → 𝕟

zero + n = n
(suc n) + n′ = suc (n + n′) 

It produces它产生

/Users/myname/trial_agda.agda:8,1-13
Missing type signature for left hand side zero + n
when scope checking the declaration
  zero + n = n

What is the problem?问题是什么?

The problem was resolved by making a gap of a line after suc: → .该问题通过在suc: →之后留出一行来解决。 In http://learnyouanagda.liamoc.net/pages/peano.html#fn1 where this example is mentioned, it is not mentioned where the example is discussed, that such a gap should be made.http://learnyouanagda.liamoc.net/pages/peano.html#fn1中提到了这个例子,但在讨论这个例子的地方没有提到应该做这样的差距。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM