Would that also work for vectors that have their length in their type? And while we are at it, how about overloaded tuples?<div><br></div><div>Paul<br><br><div class="gmail_quote">On Mon, Sep 24, 2012 at 7:19 PM, Simon Peyton-Jones <span dir="ltr">&lt;<a href="mailto:simonpj@microsoft.com" target="_blank">simonpj@microsoft.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">|  I remember a similar discussion a few years ago. The question of whether<br>
|  or not overloading list literals a good idea notwithstanding, the problem<br>
|  with this is that fromList for vectors is highly inefficient. So if<br>
|  something like this gets implemented and if vector/array literals are one<br>
|  of the main motivations then I really hope there will be no lists<br>
|  involved.<br>
<br>
</div>Would you like to remind us why it is so inefficient?  Can&#39;t the vector construction be a fold over the list?  Ah... you need to know the *length* of the list, don&#39;t you?  So that you can allocate a suitably-sized vector.  Which of course we do for literal lists.<br>

<br>
So what if fromList went<br>
        fromList :: Int -&gt; [b] -&gt; a b<br>
where the Int is the length of the list?<br>
<span class="HOEnZb"><font color="#888888"><br>
Simon<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<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></div>