What do you assume when you see fromListN in a library?

David Feuer david.feuer at gmail.com
Fri Feb 28 05:04:59 UTC 2020


Trying to deal cleanly with incorrect sizes, treated as hints, could have
performance consequences. I'm not sure how bad they'll be.

On Thu, Feb 27, 2020, 10:40 PM Zemyla <zemyla at gmail.com> wrote:

> I'm kind of the opposite. I think the number given to fromListN should be
> a "size hint", not a redundant coding of the size of the list given.
>
> On Thu, Feb 27, 2020, 21:31 chessai . <chessai1996 at gmail.com> wrote:
>
>> I expect a list with precisely length N, and reject anything else. IIRC
>> both primitive and vector do this
>>
>> On Thu, Feb 27, 2020, 6:54 PM Carter Schonwald <
>> carter.schonwald at gmail.com> wrote:
>>
>>> Hey everyone:
>>> When you see fromListN as a function in a library, do you assume /
>>> presume it’s expecting an exactly N element list ? Or do you
>>> expect/tolerate other behavior ?
>>>
>>> Should it reject shorter lists?
>>>
>>> Should it truncate or reject longer lists?
>>>
>>> A corner case of this came up in some bug discussion I was having
>>> regarding vector,  and I shall claim and or presume that most folks assume
>>> exact size with prompt rejection of too long or too short.
>>>
>>> Thoughts please ?
>>>
>>> -Carter
>>> _______________________________________________
>>> Libraries mailing list
>>> Libraries at haskell.org
>>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>>
>> _______________________________________________
>> Libraries mailing list
>> Libraries at haskell.org
>> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>>
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/libraries
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/libraries/attachments/20200228/036720c9/attachment.html>


More information about the Libraries mailing list