The H2 Wiki


scrap-your-lazy-lists

Scrap your lazy lists

Instead of lazy lists you probably want a streaming abstraction, such as

or a strict linear data structure, such as

Using lazy lists leads to bugs such as

Haskell Reddit on when we really need lazy lists

The benefits are

  1. Laziness is more “reusable” or “composable”

    See Lennart’s write up

  2. Ed Kmett’s memo table (N.B. this has linear lookup time though – the memo table based on trees is much better)

  3. take n . sort (although this is possible with streams too, I think)

  4. As a unifying type for Alternative’s many

    See https://www.reddit.com/r/haskell/comments/6h84vg/when_do_we_really_need_lazy_lists/diwhzwf/

Evidence that people believe that lists should be used as control structures