[Haskell-cafe] Laziness enhances composability: an example

Cristiano Paris frodo at theshire.org
Fri Jul 10 05:43:42 EDT 2009

2009/7/9 Marcin Kosiba <marcin.kosiba at gmail.com>:
> On Thursday 09 July 2009, Cristiano Paris wrote:
>> Thanks. In fact, I was stuck trying to find an example which couldn't
>> be written using Python's iterators. The only difference coming up to
>> my mind was that Haskell's lists are a more natural way to express a
>> program relying on laziness. That was the reason why added the clause
>> "at least not elegantly" in my first post.
> Hi,
>        I recently tried writing some code to simulate a certain protocol in Python.
> I thought I'll go the "smart" way and rely on the Python yield construct to
> do a CPS transformation of my code.
>        While this worked to a certain extent, composability was a problem, because
> any sub-procedure which used yield (and thus was an iterator) required being
> called in a rather inelegant way.

I think I'll investigate Python's Iterator composability.


More information about the Haskell-Cafe mailing list