[Haskell] Pugs gains SMP parallelism support.

Taral taralx at gmail.com
Sat Oct 21 12:58:14 EDT 2006


On 10/21/06, Audrey Tang <autrijus at gmail.com> wrote:
> I wonder if there is a more efficient way doing this...

I would use an IOArray:

let l = length xs
arr <- newArray_ (0, l)
count <- newQSemN 0
let proc n x = do
    rv <- runEvalIO env (reduce x)
    writeArray arr n rv
    signalQSemN count 1
sequence_ $ zipWith proc [0..] xs
waitQSemN count l
elems $ unsafeFreeze arr

STM might work better than a QSemN...

-- 
Taral <taralx at gmail.com>
"You can't prove anything."
    -- Gödel's Incompetence Theorem


More information about the Haskell mailing list