Haskell错误的含义是什么:
类型'B'找不到必需的祖先'A'。
答案 0 :(得分:7)
这不是Haskell错误;这是来自Data.GI.Base.Overloading模块的自定义消息:
#if MIN_VERSION_base(4,9,0)
-- | Type error to be generated when an ancestor check fails.
type family UnknownAncestorError (a :: *) (t :: *) where
UnknownAncestorError a t =
TypeError ('Text "Required ancestor ‘" ':<>: 'ShowType a
':<>: 'Text "’ not found for type ‘"
':<>: 'ShowType t ':<>: 'Text "’.")
#endif
-- | Check whether a type appears in a list. We specialize the
-- names/types a bit so the error messages are more informative.
type family CheckForAncestorType t (a :: *) (as :: [*]) :: AncestorCheck * * where
CheckForAncestorType t a '[] =
#if !MIN_VERSION_base(4,9,0)
'DoesNotHaveRequiredAncestor "Error: Required ancestor" a "not found for type" t
#else
UnknownAncestorError a t
#endif
CheckForAncestorType t a (a ': as) = 'HasAncestor a t
CheckForAncestorType t a (b ': as) = CheckForAncestorType t a as