[Haskell-cafe] Seen on reddit: or, foldl and foldr considered slightly harmful

Ketil Malde ketil at malde.org
Thu Feb 11 05:00:51 EST 2010


Johann Höchtl <johann.hoechtl at gmail.com> writes:

> In a presentation of Guy Steele for ICFP 2009 in Edinburgh:
> http://www.vimeo.com/6624203
> he "considers foldl and foldr" harmful as they hinder parallelism
> because of "Process first element, then the rest" Instead he proposes
> a divide and merge aproach, especially in the light of going parallel.

In Haskell foldl/foldr apply to linked lists (or lazy streams, if you
prefer) which are already inherently sequential, and gets a rather harsh
treatment.  I notice he points to finger trees, which I though was
implemented in Data.Sequence.

> are somewhat  geared towards Fortress, but I wonder what Haskellers
> have to say about his position.

Can we (easily) parallelize operations on Data.Sequence?  Often, the
devil is in the details, and there's a lot of ground to cover between
'trees are easier to parallelize' to an efficient and effective high
level interface.  (E.g. non-strict semantics allowing speculative
evalutaion - you still need to insert manual `par`s, right?)

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants


More information about the Haskell-Cafe mailing list