[Haskell-cafe] parMap doesn't work fine
Grigory Sarnitskiy
sargrigory at ya.ru
Thu May 12 13:29:41 CEST 2011
Hello!
I've just started using parallel computations in Haskell. parMap works fine, it is so easy to use. However, parMap fails with functions returning lazy structures, e.g. tuples.
This code works as expected:
(parMap rpar) bm tvalues
bm :: Double -> Double is some heavy function. But if I want to return list of pairs (t, bm t) it doesn't use cpu cores fine (only one is in use):
(parMap rpar) (\t -> (t, bm t)) tvalues
The same is valid for functions returning lists. How do I use multiple cores with functions returning tuples?
More information about the Haskell-Cafe
mailing list