10

我在编译时收到来自 GHC 的警告:

警告:“pats”的此绑定会隐藏“match_ignore_ancs”定义中的现有绑定

这是功能:

match_ignore_ancs (TextPat _ c) (Text t) = c t
match_ignore_ancs (TextPat _ _) (Element _ _ _) = False
match_ignore_ancs (ElemPat _ _ _) (Text t) = False
match_ignore_ancs (ElemPat _ c pats) (Element t avs xs) =
   c t avs && match_pats pats xs

知道这意味着什么以及如何解决吗?

干杯。

4

1 回答 1

11

这意味着您pats在程序的其他地方定义了一个符号或从某个库模块导入了一个符号,并且它在与 相同的范围内可见match_ignore_ancs,因此当您命名参数时pats,它会隐藏(即“阴影”)该现有符号。

只需将pats参数重命名为没有冲突的东西。

于 2010-05-25T09:32:29.030 回答