[Haskell-cafe] More on performance

Sterling Clover s.clover at gmail.com
Wed Jun 4 15:11:31 EDT 2008


> 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.


More information about the Haskell-Cafe mailing list