Oh, I got it: You want to have:

class Bird b where

class Penguin p where

instance (Penguin b) => Bird b where
   fly = -- fly method for penguins

2011/7/19 Patrick Browne <patrick.browne@dit.ie>
On 18/07/2011 19:14, Jerzy Karczmarczuk wrote:
> That's why I suggested how you might do that: for some datatypes, say
> the Emperors, you specify some special flying method (e.g. dummy or
> bombing), or you don't specify it at all. And the Emperors won't fly.

-- Here is my attempt
data Emperor = Emperor
data Robin = Robin

class Bird a where
  fly :: a -> a -> a
  walk :: a -> a -> a

instance Bird Robin where
 fly x y = y
 walk x y = x

instance Bird Emperor where
-- No fly method
  walk x y = y

class (Bird a) => Penguin a where
-- I do not think that I can override the walk method in the sub-class
-- must be done in instance of Penguin

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


Regards,
Pat

This message has been scanned for content and viruses by the DIT Information Services E-Mail Scanning Service, and is believed to be clean. http://www.dit.ie

_______________________________________________