[Haskell-cafe] Preventing sharing
wren romano
wren at community.haskell.org
Wed Dec 23 03:00:05 UTC 2015
On Tue, Dec 22, 2015 at 12:31 PM, Joachim Durchholz <jo at durchholz.org> wrote:
> It seems to show how one can transform a specific class of lazy functions
> into generators.
> This seems to miss the point of laziness. Having lazy evaluation means that
> when writing a function, you don't know (and don't care) how much of the
> returned data structure is ever explored, that's the caller's decision. This
> means you do not ever transform your code as a generator, because you don't
> need to.
To play the celestial advocate: the ability to not care about
strictness/laziness when writing a function is precisely what causes
it to be hard to reason about the space/time costs of that function.
Yes, it's nice to be able to abstract over evaluation semantics, but
that abstraction does not come for free. Where the balance between
cost and benefit tilts is, imo, less important than realizing the
nature of the tradeoff. For, there is no single optimum; the objective
function for "good programming" must weight many different concerns,
and those weights necessarily differ by context and goal.
--
Live well,
~wren
More information about the Haskell-Cafe
mailing list