Is this error message incorrect? The error has nothing to do with AApply .
Not really. This is probably an error due to which you get this error message, but not completely from the database.
Look at everything together, looking at the pieces.
test (APure) a = a
says we have a function
test :: A ab -> r -> r
Put it along with the signature
test :: (A ab) -> a -> b
and unify, ignoring the type error from the first equation, the type is refined to
test :: A rr -> r -> r
Then consider the equation
test AApply a = undefined
and see how this is unacceptable under the qualified type, since
AApply :: A (A bc) c
entail
c ~ A bc
if AApply were a valid first argument.
source share