Skip to content

Documentation of drop says it returns [] only if n > length xs

Summary

The documentation of drop states that it returns [] only if n > length xs. This is wrong, IMHO. It should be n >= length xs

Location of documentation issue: (e.g. the Haddocks of base, the GHC user's guide) https://gitlab.haskell.org/ghc/ghc/-/blob/master/libraries/base/GHC/List.hs#L921

Proposed improvements or changes

I suggest the line is changed to: -- after the first @n@ elements, or @[]@ if @n >= 'length' xs@.

This issue is also the case with the documentation of a similar function: take. I'm wondering if there is a reason for this style, but couldn't find any.

Environment

8.10.7

On a side note: If possible, I would like to make a PR if this isn't by design/on purpose.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information