This is a tricky one. The motivating example is this:
-- Overlapping instances
instance Show a => Show [a] where ...
instance Show Char where ...
data T where
MkT :: Show a => [a] -> T
f :: T -> String
f (MkT xs) = show xs ++ "\n"
Here it's clear that the only way to discharge t
On Wednesday 03 February 2010 11:34:27 am Stefan Holdermans wrote:
> I don't think it's the same thing. The whole point of the existential
> is that at the creation site of any value of type Ex the type of the
> value being packaged is hidden. At the use site, therefore, the only
> suitable instanc
Dan,
class C a where
foo :: a -> String
instance C a where
foo _ = "universal"
instance C Int where
foo _ = "Int"
[...]
Now, IncoherentInstances is something most people would suggest you
don't use
(even people who are cool with OverlappingInstances). However, it
turns out
t