2533: Generic functions that take integral arguments should
work the same way as their prelude counterparts
wnoise at ofb.net
Sat Aug 30 05:12:50 EDT 2008
On 2008-08-27, David Roundy <daveroundy at gmail.com> wrote:
> On Wed, Aug 27, 2008 at 3:19 AM, Henning Thielemann
><lemming at henning-thielemann.de> wrote:
>> It's very confusing for readers of your programs, if you use 'drop 1'
>> instead of 'tail'. The names 'drop' and 'tail' don't give the reader a hint,
>> that 'drop' works for empty lists and 'tail' doesn't. 'drop 1' and 'tail'
>> should behave identically for empty lists and a function with different
>> behaviour should have a different name.
> Personally, I'd prefer to see tail dropped from the Prelude (not any
> time soon, of course). The fewer incomplete functions are in the
> Prelude, the better, and drop has very nice and easy-to-understand
> behavior. Folks who want to crash on empty lists should write their
> own or use pattern matching.
Ditto. It's one of the more noticeable and easily avoidable sources of
crashes in my code.
I'm not being serious, but of course, it could be defined using fail,
which defaults to  in the List monad...
More information about the Libraries