Yeah guys. I confused myself. I forgot why I had to implement several
"+" operators (^+^, ^+, ^+. etc.) for Vector class. Now I've got an
idea again. Different names make a perfect sense.<br><br>Thanks a lot.<br><br><div class="gmail_quote">On Sat, Jan 24, 2009 at 6:34 AM, Luke Palmer <span dir="ltr"><<a href="mailto:lrpalmer@gmail.com">lrpalmer@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">2009/1/23 Brandon S. Allbery KF8NH <span dir="ltr"><<a href="mailto:allbery@ece.cmu.edu" target="_blank">allbery@ece.cmu.edu</a>></span><br>
<div class="gmail_quote"><div class="Ih2E3d"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div><div><div><div>On 2009 Jan 23, at 17:58, Olex P wrote:</div></div><blockquote type="cite"><div>class Vector v where<br> (^+^) :: v -> v -> v<br><br></div><div>
class Matrix m where<br> (^+^) :: m -> m -> m</div></blockquote><br></div><div>You can't reuse the same operator in different classes. Vector "owns" (^+^), so Matrix can't use it itself. You could say</div>
<div><br></div><div>> instance Matrix m => Vector m where</div><div>> (^+^) = ...</div><div></div></div></blockquote></div><div><br>No you can't! Stop thinking you can do that!<br><br>It would be sane to do:<br>
<br>class Vector m => Matrix m where<br> -- matrix ops that don't make sense on vector<br><br>Thus anything that implements Matrix must first implement Vector. Which is sane because matrices are square vectors with some additional structure, in some sense.<br>
<br>Luke<br></div></div>
</blockquote></div><br>