Andrew J Bromage <[EMAIL PROTECTED]> writes:

>       class Plus a b c | a b -> c where
>           (+) :: a -> b -> c

>       class Mult a b c | a b -> c where
>           (*) :: a -> b -> c

This kind of approach was discussed a while ago, and has a bunch of
things to recommend it.  Is the functional dependency sufficient to
avoid any ambiguity?

>       class (Eq a, Show a,
>              Plus a a a, Mult a a a, {- etc -}
>             ) => Num a

> Apart from the possibility of naming these typeclasses better, this
> reorganisation gets my vote for Haskell 2.

Add the ability to do 

        instance Num Foo where
                a + b = ...
                a - b = ...
                a * b = ...

i.e when instantiating a derived class (if one can call it that),
allow implicit instantiation of base classes.

One thing to look out for, is a hierarchy of esoterically named
classes, and consequentially, error messages incomprehensible to
people unfamiliar with the details of the hierarchy.

-kzm
-- 
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/haskell

Reply via email to