[Haskell-cafe] Call for discussion: OverloadedLists extension

Paul Visschers mail at paulvisschers.net
Tue Sep 25 09:19:58 CEST 2012

Would that also work for vectors that have their length in their type? And
while we are at it, how about overloaded tuples?


On Mon, Sep 24, 2012 at 7:19 PM, Simon Peyton-Jones
<simonpj at microsoft.com>wrote:

> |  I remember a similar discussion a few years ago. The question of whether
> |  or not overloading list literals a good idea notwithstanding, the
> problem
> |  with this is that fromList for vectors is highly inefficient. So if
> |  something like this gets implemented and if vector/array literals are
> one
> |  of the main motivations then I really hope there will be no lists
> |  involved.
> Would you like to remind us why it is so inefficient?  Can't the vector
> construction be a fold over the list?  Ah... you need to know the *length*
> of the list, don't you?  So that you can allocate a suitably-sized vector.
>  Which of course we do for literal lists.
> So what if fromList went
>         fromList :: Int -> [b] -> a b
> where the Int is the length of the list?
> Simon
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120925/13f91a5b/attachment.htm>

More information about the Haskell-Cafe mailing list