[Haskell-cafe] Call for discussion: OverloadedLists extension
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
> | with this is that fromList for vectors is highly inefficient. So if
> | something like this gets implemented and if vector/array literals are
> | 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?
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Haskell-Cafe