Proposal: Add strict iterate'

David Feuer david.feuer at
Sun Aug 10 18:42:58 UTC 2014

I thought so for a moment, but someone else (I don't remember who)
showed me why I was wrong. This headStrict function doesn't force
everything in the list. Rather, it ensures that the car of each cons
is forced *when that cons is forced*. That is, if we had

data SList a = SNil | SCons !a (SList a)

this function could be seen as converting [a] to SList a and back, lazily.

On Sun, Aug 10, 2014 at 2:14 PM, Henning Thielemann
<schlepptop at> wrote:
> Am 06.08.2014 um 19:46 schrieb Bas van Dijk:
>> As suggested[1] by Takano Akio a few years ago iterate can be made
>> strict by applying headStrict to its result:
>> headStrict :: [a] -> [a]
>> headStrict = foldr (\x y -> seq x (x : y)) []
> Can this be achieved with some of the evaluation strategies from
> Control.Parallel.Strategies, too?

More information about the Libraries mailing list