On 14/04/06, Dave Menendez <[EMAIL PROTECTED]> wrote: > The tricky part is dealing with multiple subclasses. > > For example, > > class Functor f where > fmap :: (a -> b) -> f a -> f b > > class Functor f => Monad f where > ... > fmap = liftM > > class Functor f => Comonad f where > ... > fmap = liftW > > newtype Id a = Id a > > instance Functor Id > instance Monad Id > instance Comonad Id > > Which default gets used for fmap?
The simple solution is to make it an error, and force the programmer to define an instance of Functor as soon as that happens. Most of the problems seem to happen in mostly-linear hierarchies anyway. _______________________________________________ Haskell-prime mailing list Haskell-prime@haskell.org http://haskell.org/mailman/listinfo/haskell-prime