You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: