&gt; Vector (Complex a) is a vector with respect to both &#39;a&#39; and &#39;Complex a&#39;.<br><br>Even worse, () is a vector w.r.t. *every* scalar type.<br><br><div class="gmail_quote">On Sat, Oct 30, 2010 at 3:07 AM, Henning Thielemann <span dir="ltr">&lt;<a href="mailto:schlepptop@henning-thielemann.de">schlepptop@henning-thielemann.de</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">wren ng thornton schrieb:<br>
<div class="im">&gt; On 10/22/10 8:46 AM, Alexey Khudyakov wrote:<br>
&gt;&gt; Hello everyone!<br>
&gt;&gt;<br>
&gt;&gt; It&#39;s well known that Num &amp; Co type classes are not adequate for vectors<br>
&gt;&gt; (I don&#39;t mean arrays). I have an idea how to address this problem.<br>
&gt;&gt;<br>
&gt;&gt; Conal Elliott wrote very nice set of type classes for vectors.<br>
&gt;&gt; (Definition below). I used them for some time and quite pleased. Code is<br>
&gt;&gt; concise and readable.<br>
&gt;&gt;<br>
&gt;&gt;  &gt; class AdditiveGroup v where<br>
&gt;&gt;  &gt; zeroV :: v<br>
&gt;&gt;  &gt; (^+^) :: v -&gt; v -&gt; v<br>
&gt;&gt;  &gt; negateV :: v -&gt; v<br>
&gt;&gt; [...]<br>
&gt;&gt; I&#39;d like to know opinion of haskellers on this and specifically opinion<br>
&gt;&gt; of Conal Eliott as author and maintainer (I CC&#39;ed him)<br>
<br>
</div>Looks like you are about to re-implement numeric-prelude. :-)<br>
<div class="im"><br>
&gt; Just my standard complaint: lack of support for semirings, modules, and<br>
&gt; other simple/general structures. How come everyone&#39;s in such a hurry to<br>
&gt; run off towards Euclidean spaces et al.?<br>
&gt;<br>
&gt; I&#39;d rather see,<br>
&gt;<br>
&gt;     class Additive v where -- or AdditiveMonoid, if preferred<br>
&gt;         zeroV :: v<br>
&gt;         (^+^) :: v -&gt; v -&gt; v<br>
&gt;<br>
&gt;     class Additive v =&gt; AdditiveGroup v where<br>
&gt;         negateV :: v -&gt; v<br>
&gt;<br>
&gt;     type family Scalar :: * -&gt; *<br>
<br>
</div>Vector (Complex a) is a vector with respect to both &#39;a&#39; and &#39;Complex a&#39;.<br>
<div><div></div><div class="h5"><br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
<a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>