Skip to content

Data.List.insert / insertBy do not match the documentation

In Data.List from base 4.6.0.0 (as in every previous version), the documentation for insert says "The insert function takes an element and a list and inserts the element into the list at the last position where it is still less than or equal to the next element." However:

insert 1 [2,3,4,2,3,4]

[1,2,3,4,2,3,4]

One could correct the code to match the documentation. However, any maximally productive version is likely quite a bit less efficient than the current code, and the documented behavior doesn't seem terribly useful.

Instead, I suggest patching the documentation in the obvious way: "The insert function takes an element and a list and inserts the element into the list at the first position where it is less than or equal to the next element."

Trac metadata
Trac field Value
Version 7.6.1
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component libraries/base
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information