[Haskell-cafe] Can subclass override its super-class' default implementation of a function?

siki gabor at karamaan.com
Mon Apr 27 17:37:32 EDT 2009

The actual problem is quite similar to the one that I provided or to the one
in the description of the proposed extension that you linked. 

Someone on another forum suggested record functions but I'm not sure I
understood correctly how that would work around this problem. Any suggestion
is greatly appreciated!



Martijn van Steenbergen-2 wrote:
> siki wrote:
>> I'm not sure if this is possible at all. I'd like to do something like
>> this:
>> class A a where
>>     foo :: a -> Double
>>     foo a = 5.0
>> class (A a) => B a where
>>     foo a = 7.0
> This is currently not possible in Haskell. It's been proposed, though:
> http://haskell.org/haskellwiki/Class_system_extension_proposal
> If you have an actual example we might be able to come up with a 
> different way of modelling it so that it does what you want, though.
> Martijn.
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe

View this message in context: http://www.nabble.com/Can-subclass-override-its-super-class%27-default-implementation-of-a-function--tp23264975p23265759.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

More information about the Haskell-Cafe mailing list