Scrap your lazy lists
Instead of lazy lists you probably want a streaming abstraction, such as
streamingpipesconduit
or a strict linear data structure, such as
SeqArrayVector
Using lazy lists leads to bugs such as
Haskell Reddit on when we really need lazy lists
The benefits are
Ed Kmett’s memo table (N.B. this has linear lookup time though – the memo table based on trees is much better)
take n . sort(although this is possible with streams too, I think)As a unifying type for
Alternative’smanySee https://www.reddit.com/r/haskell/comments/6h84vg/when_do_we_really_need_lazy_lists/diwhzwf/