Skip to content

Data.List.isSuffixOf can be very inefficient

Data.List.isSuffixOf reverses both lists it is given. Thus, for example,

[12] `isSuffixOf` [1::Int .. (10^9)]

will build the complete list [10^9, (10^9-1)..1] in memory.

Trac metadata
Trac field Value
Version 7.8.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Core Libraries
Test case
Differential revisions
BlockedBy
Related
Blocking
CC core-libraries-committee@haskell.org
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information