Skip to content
  • Xia Li-yao's avatar
    Improve lazy performance of `Data.Text.Lazy.inits` · da671cc1
    Xia Li-yao authored and Bodigrim's avatar Bodigrim committed
    The previous implementation, itself based on an earlier version of
    `Data.List.inits`, inherited the flaw that accessing the i-th element took
    quadratic time O(i²). This now takes linear time O(i) as expected.
    The current version of `Data.List.inits` uses a banker's queue to
    obtain good performance when generating very long lists.
    For lazy text, consisting of a few big chunks, that benefit seems
    negligible. So I chose a simpler implementation.