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

John Meacham john at repetae.net
Tue Aug 26 20:57:42 EDT 2008

On Fri, Aug 22, 2008 at 05:49:22PM +0200, Henning Thielemann wrote:
>>> 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.

But is also makes the functions less useful and another source of
non-completeness. I certainly always considered accepting negative
numbers a feature of those functions and not an infelicity.  Sometimes
you want 'drop 1 xs' and other times you want 'tail xs' (or equivalent).


John Meacham - ⑆repetae.net⑆john⑈

More information about the Libraries mailing list