如何编写带有两个参数的类型签名?

How to write a type signature with two parameters?

我尝试学习 agda 并使用 tutorial。 我粘贴两个相互递归集的代码

module MoreSets where 

data List₁ (A B : Set) : Set
data List₂ (A B : Set) : Set

data List₁ (A B : Set) where
  []  :                 List₁ A B
  _∷_ : A → List₂ A B → List₁ A B

data List₂ (A B : Set) where
  _∷_ : B → List₁ A B → List₂ A B

并得到错误

MoreSets.agda:6,12-23
Unexpected type signature for parameters A B
when checking the definition of List₁

我假设有一个微不足道的错误,但看不到它。

没有深入范畴论的Haskell程序员学习agda的简单教程是什么?

您不应该重复您拥有的类型注释 在定义归纳类型时的声明中。所以:

module MoreSets where

data List₁ (A B : Set) : Set
data List₂ (A B : Set) : Set

data List₁ A B where
  []  :                 List₁ A B
  _∷_ : A → List₂ A B → List₁ A B

data List₂ A B where
  _∷_ : B → List₁ A B → List₂ A B