Costs of a class hierarchy

Dylan Thurston
Thu, 10 Jul 2003 12:08:24 -0400

Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Thu, Jul 10, 2003 at 02:33:25PM +0100, Ross Paterson wrote:
> Subclasses in Haskell cover a range of relationships, including this
> sense where things in the subclass automatically belong to the superclass.
> Other examples include Eq => Ord and Functor vs Monad.  In such cases it
> would be handy if the subclass could define defaults for the superclass
> methods (e.g. Ord defining (==)), so that the superclass instance could
> be optional.

I agree, but this needs to be carefully thought out.  For instance,
remember to consider the case that there is more than one default
instance for a given method of a superclass.  I am reminded of
multiple inheritance considerations.

(These difficulties came up before when I was thinking about the
numeric heirarchy, and was the reason I proposed a heirarchy which was
much less fine-grained than, e.g., in Mechvelliani's proposal.)


Content-Type: application/pgp-signature
Content-Disposition: inline

Version: GnuPG v1.2.2 (GNU/Linux)