G'day all. On Fri, Jul 18, 2003 at 04:08:25AM -0400, Dylan Thurston wrote:
What's wrong with that solution?
Working with these operators, I would spend a significant amount of time getting the '<' and '>' notations right rather than writing code. I don't like that. For example, using the suggested notation:
v1 + v2 = v3 v1 +> p1 = p2 p1 <+ v1 = p2
Quickly, without thinking too much, where do the '<' and '>' signs go here? p1 + v1 + v2 v1 + v2 + p1 v1 + p1 + v2
p1 <- v1 = p2
I'm pretty sure that's a syntax error. If not, it probably should be.
Vector - Point = Point -- (this rule is a bit controversial) This one is obviously an error. Add Point to both sides to get the error that you noted above.
It depends. If you allow the parity inversion operator -Point, then this operation makes a certain amount of sense. Some implementations (e.g. RenderMan) allow it, some don't. (But then, RenderMan defines Point + Bivector = Point. Clifford algebraists may now run screaming.)
The other potential solution is to use an 'Additive' class
class Additive a b c | a b -> c, c a -> b, c b -> a where (+) :: a -> b -> c class (Additive c b a) => Subtractive a b c where (-) :: a -> b -> c
Actually, that's not bad at all. It's certainly better than my previous suggestion of only putting a b -> c on "Additive" typeclass. Cheers, Andrew Bromage