[Haskell-cafe] partial inheritance

Malcolm Wallace malcolm.wallace at me.com
Tue Jul 19 09:59:25 CEST 2011





On 19/07/2011, at 0:09, Patrick Browne <patrick.browne at dit.ie> wrote:

> instance Bird Emperor where
> -- No fly method
>   walk x y = y
> 
> instance Penguin Emperor where
> -- How can I override the walk method in the instance Penguin?
> -- walk x y = x

Why would you want to override the walk method for Emperor?  It already has one due to being a Bird.  How could you possibly distinguish an Emperor walking as a Bird from an Emperor walking as a Penguin?  Why would it be desirable?



More information about the Haskell-Cafe mailing list