
Would that also work for vectors that have their length in their type? And
while we are at it, how about overloaded tuples?
Paul
On Mon, Sep 24, 2012 at 7:19 PM, Simon Peyton-Jones
| 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@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe