Consider the following example:
{-# LANGUAGE TypeSynonymInstances, ContextConstraints #-}
type A = Int
class Test a where
test :: a -> [Char]
instance Test Int where
test _ = "Int"
instance Test A where
test _ = "A"
main = do print $ test (0::Int)
print $ test (0::A)
The two instances are considered duplicates of each other. ContextConstraints allows them, but always uses the first declared instance (in this case, Test Int). Distinguish between instances for a type and instances for synonyms.
Consider the following example:
{-# LANGUAGE TypeSynonymInstances, ContextConstraints #-}
The two instances are considered duplicates of each other. ContextConstraints allows them, but always uses the first declared instance (in this case, Test Int). Distinguish between instances for a type and instances for synonyms.