Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-30 Thread Jan-Willem Maessen
On Sun, Sep 29, 2013 at 9:13 PM, Ryan Newton rrnew...@gmail.com wrote: Thanks, that's interesting to know (re: Fortress). Interestingly, in my Fortress days we looked at both using a split-like interface and at a more foldMap / reduce - like interface, and it seemed like the latter worked

Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-30 Thread Ryan Newton
Oops, this email got stuck in the pipe (flaky internet): foldMap _ Tip = mempty foldMap f (Bin _ _ v l r) = Foldable.foldMap f l `mappend` f v `mappend` Foldable.foldMap f r Btw, from my perspective, one problem with relying on foldMap is that it treats the whole structure uniformly,

Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-29 Thread Mike Izbicki
I've got a Partitionable class that I've been using for this purpose: https://github.com/mikeizbicki/ConstraintKinds/blob/master/src/Control/ConstraintKinds/Partitionable.hs The function called parallel in the HLearn library will automatically parallelize any homomorphism from a Partionable to a

Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-29 Thread Jan-Willem Maessen
On Sat, Sep 28, 2013 at 1:09 PM, Ryan Newton rrnew...@gmail.com wrote: Hi all, We all know and love Data.Foldable and are familiar with left folds and right folds. But what you want in a parallel program is a balanced fold over a tree. Fortunately, many of our datatypes (Sets, Maps)

Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-29 Thread Ryan Newton
Thanks, that's interesting to know (re: Fortress). Interestingly, in my Fortress days we looked at both using a split-like interface and at a more foldMap / reduce - like interface, and it seemed like the latter worked better – it requires a lot less boilerplate for controlling recursion, and

[Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-28 Thread Ryan Newton
Hi all, We all know and love Data.Foldable and are familiar with left folds and right folds. But what you want in a parallel program is a balanced fold over a tree. Fortunately, many of our datatypes (Sets, Maps) actually ARE balanced trees. Hmm, but how do we expose that? It seems like it

Re: [Haskell-cafe] What class for splittable data / balanced-fold?

2013-09-28 Thread adam vogt
On Sat, Sep 28, 2013 at 1:09 PM, Ryan Newton rrnew...@gmail.com wrote: Hi all, We all know and love Data.Foldable and are familiar with left folds and right folds. But what you want in a parallel program is a balanced fold over a tree. Fortunately, many of our datatypes (Sets, Maps)