On Jun 4, 2008, at 5:51 AM, Henning Thielemann wrote:
How about assisting the compiler with a helper function named 'parallel' ?

parallel :: ([a] -> b, [a] -> c) -> [a] -> (b,c)
parallel (f,g) xs = (f xs, g xs)

mean xs =
  uncurry (/) $ parallel (sum,length) xs


? We could state RULES in terms of 'parallel'. By calling 'parallel', the user tells, that he wants fusion here.

Say
  "parallel/foldl/foldl" forall f, g, x0, y0.
parallel (foldl f x0, foldl g y0) = foldl (\(x,y) z -> (f x z, g y z)) (x0,y0)


Well, we already have &&&. Would a sufficiently specialized rule over that be a useful addition to Control.Arrow?

Regards,
Sterl.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to