2533: Generic functions that take integral arguments should work the same way as their prelude counterparts

Alexander Dunlap alexander.dunlap at gmail.com
Sat Aug 23 01:50:27 EDT 2008


On Fri, Aug 22, 2008 at 8:49 AM, Henning Thielemann
<lemming at henning-thielemann.de> wrote:
>
> On Fri, 22 Aug 2008, Neil Mitchell wrote:
>
>> Hi
>>
>>> The Prelude functions drop, take, and splitAt are unfailing (never
>>> call error). This patch changes the Data.List generic versions to
>>> behave the same way. At present, they call error on negative
>>> arguments.
>>
>> I had always just assumed that take and genericTake did the same
>> thing, so had never even realised this problem existed. I'd call this
>> a bug, that needs fixing.
>
> Maybe the bug is in 'drop', 'take' and 'splitAt' and it was intended to fix
> it in 'generic' variants. Is there a good reason why to ignore negative
> number arguments? It may hide bugs.
> _______________________________________________
> Libraries mailing list
> Libraries at haskell.org
> http://www.haskell.org/mailman/listinfo/libraries
>

I agree (although the Report doesn't). There's no reason for those
functions to be called with negative arguments; all it will do is hide
bugs.

Alex


More information about the Libraries mailing list