[Haskell-cafe] Preventing sharing
Oleg
oleg at okmij.org
Tue Dec 22 12:31:56 UTC 2015
Henk-Jan van Tuyl wrote:
> In paper "Why Functional Programming Matters"[0], John Hughes shows how
> lazy functional programming can be used for better modularity. A more
> precise title for the paper would be "Why Lazy Functional Programming
> Matters".
The first paragraph of our paper (published 3 years ago)
http://okmij.org/ftp/ftp/continuations/PPYield/index.html#introduction
is as follows
Lazy evaluation is regarded as one of the main reasons why functional
programming matters \cite{hughes:matters-cj}. Lazy evaluation lets us
write \emph{producers} and \emph{consumers} separately, whereas the
two are inextricably intertwined in a call-by-value language. This
separation allows a modular style of programming, in which a variety
of producers, consumers, and transformers can readily be ``plugged
together.'' Lazy evaluation is also an elegant implementation of a
form of coroutines, suspending and resuming computations based on the
demand for values, giving us memory-efficient, incremental computation
`for free'
\cite{McIlroy:1999:PSP:968592.968597,Bird:1984:UCP,AG-embed}.
But do read the next paragraph and the rest of the paper, and other
articles on the web site
http://okmij.org/ftp/continuations/PPYield/index.html
Our conclusion is that the modularity benefit of lazy evaluation can
be held without lazy evaluation, gaining the predictability of the
space and time behavior.
More information about the Haskell-Cafe
mailing list