[Haskell-cafe] Computing sums

Andrew Coppin andrewcoppin at btinternet.com
Sat Feb 20 07:10:47 EST 2010

Stephen Tetley wrote:
> Hi Andrew
> "Spot the difference"
> data Property x y = forall s. Property s (x -> s -> s) (s -> y)
> data Fold b c = forall a. F (a -> b -> a) a (a -> c)
> The later is from:
> http://squing.blogspot.com/2008/11/beautiful-folding.html
> Max Rabkin's is is closer to the original argument ordering of foldl.

Hmm. So somebody else has come up with the exact same solution to the 
same problem.

My problem isn't exactly the same though. I'm interested in computing a 
"property" of a list, and recomputing it as elements are appended to the 
list. My "Property" structure provides an efficient way to do this, and 
to do so composibly. (E.g., if I want the maximum of the mean or 
something. Maximum and mean are both folds.)

PS. Epic, epic comment spam.

More information about the Haskell-Cafe mailing list