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">&lt;<a href="mailto:lrpalmer@gmail.com">lrpalmer@gmail.com</a>&gt;</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">&lt;<a href="mailto:allbery@ece.cmu.edu" target="_blank">allbery@ece.cmu.edu</a>&gt;</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>&nbsp;&nbsp;&nbsp; (^+^)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :: v -&gt; v -&gt; v<br><br></div><div>
class Matrix m where<br>&nbsp;&nbsp;&nbsp; (^+^)&nbsp;&nbsp;&nbsp;&nbsp; :: m -&gt; m -&gt; m</div></blockquote><br></div><div>You can&#39;t reuse the same operator in different classes. &nbsp;Vector &quot;owns&quot; (^+^), so Matrix can&#39;t use it itself. &nbsp;You could say</div>

<div><br></div><div>&gt; instance Matrix m =&gt; Vector m where</div><div>&gt; &nbsp; (^+^) = ...</div><div></div></div></blockquote></div><div><br>No you can&#39;t!&nbsp; Stop thinking you can do that!<br><br>It would be sane to do:<br>

<br>class Vector m =&gt; Matrix m where<br>&nbsp;&nbsp;&nbsp; -- matrix ops that don&#39;t make sense on vector<br><br>Thus anything that implements Matrix must first implement Vector.&nbsp; Which is sane because matrices are square vectors with some additional structure, in some sense.<br>

<br>Luke<br></div></div>
</blockquote></div><br>