简体   繁体   中英

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:

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: → . 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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