Re:Existential Haskell
by rrobukef on Friday November 27, 2020 @09:07AM
(#25228787)
Since Haskell is lazy you can feed final list to its construction (like the prime sieve examples).
Combination in a single-pass is optimisable by loop-fusion. Though optimisations are famous for 'flaking out' at the worst moment.
[ Parent
| on HN ]
With [a] -> b, when production of the input elements requires I/O and you don't want to read the entire list beforehand, you are forced to use lazy I/O, which is notoriously flaky and doesn't handle errors well.
Meanwhile, with a Collector, you can read the inputs with standard IO actions just fine, and feed them as they are produced.