
18 Jul
2011
18 Jul
'11
8:52 a.m.
Patrick Browne
Is it possible to model partial inheritance using Haskell type classes? For example, if the class Bird has a flying method can we represent Penguins as a sub-class of Bird without a flying method?
I'm not sure the question makes sense, if "fly" is a method of class Bird, then it can't also be a member of class Penguin. You can of course make instances of Bird without implementing the "fly" method (whether they are also instances of Penguin or not), or by implementing it as "undefined". -k -- If I haven't seen further, it is by standing in the footprints of giants