On Nov 5, 2009, at 8:26 AM, Jason Dagit wrote:
I can't really think of how laziness and polymorphism are related.
For me the big win with laziness is composability. Laziness allows
us to express things in ways that are more natural. The prelude
function 'take' is a perfect example. It allows you to use finite
portions of infinite lists. You could then express an infinite
series very naturally and then decouple from that the logic to
process finite parts. The implication here is that laziness allows
you to use data structures for control flow. This all works
together to enable separation of concerns. Which is generally a
very good thing if you want to reason about your source code.
My bad, I meant polymorphism as the answer as to why things are boxed.
Laziness can also be thought of as a transformation on the time
complexity of algorithms. Sure, the worst-case complexity still
remains but often you can get a better average case by only
computing as much as you need.
I hope that helps,
It does.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe