--------------------It would be nice to be able to overload class-functions like classes: instance (+), (-) -> Vector where (+) v1 v2 = ... (-) v1 v2 = ... --------------------instead of overloading parts of a class... (because of runtime-errors!) instance Num Vector where (+) v1 v2 = ... (-) v1 v2 = ... (*) _ _ = undefined (/) _ _ = undefined --------------------or BETTER just to split classes: class HalfBody a => (Num a =>(+), (-)) where instance HalfBody Vector where (+) v1 v2 = ... (-) v1 v2 = ... --------------------instead of defining new operators... class HalfBody a where (+§) :: a -> a -> a (-§) :: a -> a -> a instance (Num a) => HalfBody a where (+§) = (+) (-§) = (-) instance HalfBody Vector where (+§) v1 v2 = ... (-§) v1 v2 = ... --------------------------------------------------------------------------------
One is to allow function overloading. This is probably not desirable because it turns type checking into an NP-hard problem.