在Haskell中,如果绑定"遮蔽现有绑定"是什么意思?

Ali*_*air 9 haskell compiler-warnings ghc

我在编译时收到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
Run Code Online (Sandbox Code Playgroud)

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

干杯.

GS *_*ica 9

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

只需将pats参数重命名为没有碰撞的东西.