我在以下程序的最后一行中遇到类型错误:
Require Import List.
Import ListNotations.
(* This computes to 10 *)
Compute (fold_right plus 0 [1;2;3;4]).
(* I want this to compute to [5;6;7;8] but it gives a type error instead *)
Compute (fold_right app [] [[5;6]; [7;8]]).
Run Code Online (Sandbox Code Playgroud)
这是我得到的错误:
Error:
The term "app" has type "forall A : Type, list A -> list A -> list A" while it is expected to have type
"Type -> ?A -> ?A" (cannot instantiate "?A" because "A" is not in its scope).
Run Code Online (Sandbox Code Playgroud)
我真的不明白为什么我会收到这个错误.这里app
和plus
这里有什么不同?它app
是多态的plus
还是单态nat -> nat -> nat
函数吗?
如果重要的话,我的Coq版本是8.5.