[Haskell-cafe] Preventing sharing

Tom Ellis tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk
Mon Dec 28 12:42:32 UTC 2015


On Sat, Dec 26, 2015 at 12:26:30AM +0900, Oleg wrote:
> Kim-Ee Yeoh wrote:
> > However, the record remains that Oleg has offered little by way of elegant
> > bolting. His lazy programs based on a strict language tend to be cluttered
> > with lazy and force functions that uglify previously elegant code.
> >
> > His arguments would persuade many more folks if, for instance, he could
> > offer lazy-over-strict translations of Doug McIlroy's power serious
> > one-liners with no loss in elegance:
> >
> > http://www.cs.dartmouth.edu/~doug/powser.html
> 
[...]
> can we re-write Doug McIlroy's code in a strict language without ever
> using lazy and force or thunks everywhere -- basically maintaining the
> same structure of the code.
> 
> I took the challenge and re-wrote the powser code in OCaml, a strict
> language.
[...]
> There is no lazy/force in sight. Lazy/force could be used to implement
> the infinite stream data type (what has been prefixed with I) but no
> user of the stream library needs to know how exactly it is
> implemented. In particular, all McIlroy's code is written without any
> use of lazy/force. His code in OCaml has essentially the same
> structure as Haskell code, considering the syntactic differences
> between the two languages.
[...]
> The point is that well-chosen combinators are far more important than
> strict/lazy evaluation differences.

Thanks for that, Oleg.  I am very much in agreement with you that we can
have access to laziness within strict languages with no less elegance than
we have access to IO in pure languages.

Tom


More information about the Haskell-Cafe mailing list