在软件基础"QuickChick“的第4卷中,我们有以下摘录:
Class Ord A `{Eq A} : Type :=
{
le : A -> A -> bool
}.
(* Define [Ord] instances for options and pairs. *)
(* So I am trying to do it *)
Instance optionOrd {A : Type} `{Ord A} `{Eq (option A)} : Ord (option A) :=
{
le := fun (opt1 opt2 : option A) =>
match opt1 with
| None => match opt2 with
| None => true
| Some a => true
end
| Some a1 => match opt2 with
| None => false
| Some a2 => le a1 a2
end
end.
}.但是得到一个错误:
Error: Syntax error: '}' expected after [constr:record_declaration]
(in [vernac:gallina_ext]).它突出了match opt1 with。
发布于 2020-08-06 22:07:20
只需在上一次.之后删除end。
https://stackoverflow.com/questions/63291803
复制相似问题