On Sun, Jan 21, 2007 at 06:21:34PM +0100, Hans van Thiel wrote: > class (Num a, Monoid a) => NumMon a where > e = 0 > add x y = x + y
> What am I doing wrong? Many thanks in advance. Nothing! What you are trying to do, declare a class B containing all members of a class A, is simply not supported in Haskell. This is the closest you'll get with Haskell98: > newtype Wrap a = Wrap (Wrap a) > instance Num a => Monoid (Wrap a) where > e = Wrap 0 > add (Wrap x) (Wrap y) = Wrap (x + y) This is the closest you'll get with GHC extensions: > {-# OPTIONS_GHC -fallow-undecidable-instances #-} > instance Num a => Monoid a where > e = 0 > add = (+) Hope this helps. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe