Koen Claessen wrote:
> In this case we could allow the programmer giving a default declaration
> for the superclass methods during the class definition of the subclass. An
> example would be: 
Allowing defaults to be given in subclasses has been discussed.
If it was problem free I think it would have been in Haskell now,
but there is an ambiguity problem when there are several different
defaults available. E.g.

class C a where
    m :: a -> Int

class (C a) => C1 a where
    m x = 1

class (C a) => C2 a where
    m x = 2

class (C1 a, C2 a) => C12 a

f :: (C12 a) => a -> Int
f x = m x

Will f return 1 or 2?
Since C12 is a subclass of C in two different ways and there
are two different defaults there is an ambiguity.  
I guess you could "solve" it by forbidding this case.

        -- Lennart





Reply via email to