Is there anything that documents this further than the Haddock documentation 
available from Haskell.org or the GHC pages?  I've gotten some basic 
parallelism to work using parMap and using >|| and >|, but I had a fold and a 
map that I could logically compute at the same time.  

I found this example for quicksort using GPH:

import Strategies


main = print (quicksort ([999,998..0]::[Int]))

quicksort :: (Ord a, NFData a) => [a] -> [a]
quicksort [] = []
quicksort [x] = [x]
quicksort (x:xs) = (lo ++ (x:hi)) `using` strategy
        where
        lo = quicksort [ y | y <- xs, y < x]
        hi = quicksort [ y | y <- xs, y >= x]
        strategy result = rnf lo `par`
                        rnf hi `par`
                        rnf result

Is the syntax the same for GHC using Control.Parallel.Strategies?  If so, does 
the following execute the two computations from the where clause in parallel?

import Control.Parallel
import Control.Parallel.Strategies

stats bigList summation mean = (stddev, proportions) `using` strategy
        where 
        stddev = sqrt (fold ((+) . (^2) . (-mean)) 0 bigList)
        proportions = map (/summation) bigList
        strategy result = rnf stddev >|| 
                        rnf proportions >|| 
                        rnf result

Thanks!
--Jeff
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to