[Haskell-cafe] List spine traversal

Andrew Hunter andrewhhunter at gmail.com
Tue Jun 30 16:29:46 EDT 2009

On Mon, Jun 29, 2009 at 11:30 PM, Ryan Ingram<ryani.spam at gmail.com> wrote:
> There can't be a way to do so that is pure, because such a function
> could distinguish between
>> xs1 = () : xs1
> and
>> xs2 = f () where f () = () : f ()

But doesn't seq and friends cause many of our normal referential
transparency guarantees to be invalid?  Are you certain that claim
holds in the presence of seq?

As a side note, (allowing seq and unsafePerformIO if necessary) is it
possible to implement a map that preserves cycles (instead of
transparently replacing them with infinite copies?  Not horribly
useful, but would be quite cute.


More information about the Haskell-Cafe mailing list