G'day all. On Thu, Jul 17, 2003 at 04:46:13PM +0100, Jon Fairbairn wrote:
> Someone mentioned multiplying by a scalar. I think this is a > good application, but what we need is to agree (somehow) on > the symbol used. I've used (*.) and (.*), with the dot being > on the side the scalar is on (on the grounds that . is a > scalar product elsewhere), but without wide agreement I > agree that this sort of thing reduces readability, because > while I can read these programmes, it's harder for everyone > else. Yuck. :-) I've run into the same problem with affine algebra, which has two types, the Point and the Vector, where a Vector is the difference between two Points: Vector + Vector = Vector Vector + Point = Point Point + Vector = Point Point + Point is an error Vector - Vector = Vector Point - Vector = Point Vector - Point = Point -- (this rule is a bit controversial) Point - Point = Vector It's not obvious what to call the operators here. One solution might be to relax the rules about how the types of operators are resolved. At the moment, you can define function names from different modules and all you need to do is qualify them when you use them. It's a little odd that you can't do something similar with operators, though no succinct syntax leaps to mind. Of course you could always allow overloading _without_ requiring module qualification (unless the overloading can't be resolved using type information). It'd make type checking NP-hard, but I seem to recall that it's already more complex than that. Cheers, Andrew Bromage _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell