为什么 `:type` 有时显示 `a` 而其他时候显示 `t`?

Why does `:type` sometimes show `a` and other times `t`?

我有这两个功能:

cleanUp a = Data.List.filter (/=[]) a

joinByPairs [] = []
joinByPairs (x:[]) = (x:[])
joinByPairs (x:y:xs) = (x ++ y) : joinByPairs xs

当我在 ghci 中加载它们并对其调用 :type 时,我得到了这些结果:

*Main> :type joinByPairs
joinByPairs :: [[a]] -> [[a]]
*Main> :type cleanUp
cleanUp :: Eq t => [[t]] -> [[t]]

它显示 at 的逻辑是什么?我不认为这是因为 Eq t 部分,因为我有其他功能显示 otherFunction :: Eq a => [[a]] -> [[a]].

这是因为类型变量名称的选择方式。全新变量获得 t。在类型签名中命名的类型变量保留类型签名中的名称。统一类型变量时,GHC 更喜欢保留来自显式类型签名的名称。如果没有子表达式具有显式类型签名,则除了 t 之外没有其他名称可以统一。