Hello Haskellers!<br>It's probably a simple question but I can't find a proper solution...<br>Suppose we have a class Vector which overloads (+) operation. I'd like to represent a Matrix data type as a set of vectors:<br>
<br>data Matrix3 = M3 !Vector3 !Vector3 !Vector3<br><br>In this case (+) for matrices could be implemented as:<br><br> (M3 r11 r12 r13) + (M3 r21 r22 r23) = M3 (r11 + r21) (r12 + r22) (r13 + r23)<br><br>But GHC says about ambiguous occurrence. I don't understand why because it's should be pretty clear that rows are vectors and (+) has to be vector type as well. I could use Vector.+ instead but it doesn't look good.<br>
Probably I'm missing something. Any ideas?<br><br>Cheers,<br>Oleksandr.<br>