为什么 'neutral' 不规范化为列表幺半群中的“[]”?

Why does 'neutral' not normalize to '[]' in the List monoid?

以下 Idris 定义使用 Idris 1.3.0 进行类型检查:

foo : (xs : List Nat) -> xs = ([] <+> xs)
foo xs = Refl

然而,这不是:

foo : (xs : List Nat) -> xs = (neutral <+> xs)
foo xs = Refl

出现以下类型错误:

 When checking right hand side of foo with expected type
         xs = neutral <+> xs

 Type mismatch between
         neutral ++ xs = neutral ++ xs (Type of Refl)
 and
         xs = neutral ++ xs (Expected type)

 Specifically:
         Type mismatch between
                 neutral ++ xs
         and
                 xs

为什么 neutral <+> xs 在这里没有标准化为 xs

neutral 将被解释为隐式参数,因为它是小写的并且出现在类型声明中。但是你可以只指定模块。 :doc neutral 给我 Prelude.Algebra.neutral:

foo : (xs : List Nat) -> xs = (Algebra.neutral <+> xs)
foo xs = Refl