:-) Thank you for your kindness. I mean... your frankness.

I had another issue in that code which clearly shows that I don't know how to use parMap or strategies in general. Maybe this is better:

weirdParMap action = sequence_ . map action . parMap rwhnf (\x -> x `seq` x)

   or maybe that's overkill and this is sufficient:

weirdParMap action = sequence_ . map action . parMap rwhnf id

   or this:

weirdParMap action list = sequence_ $ map action (list `using` rnf)

(which I guess would require the appropriate NFData instanbe for the pixel type)

   or maybe I still don't know enough about this Parallel Haskell thingy.

In any case... couldn't something like this be what was needed in the OP?

JCAB

On Tue, 17 Apr 2007 17:56:27 -0700, Stefan O'Rear <[EMAIL PROTECTED]> wrote:

On Tue, Apr 17, 2007 at 05:49:11PM -0700, Juan Carlos Arevalo Baeza wrote:
I may be talking out of my other end here, but... if you want something like parMap to calculate all the pixels in parallel, then... can't you use
parMap itself?

   Something like:

weirdParMap action = sequence_ . map action . parMap (id $!)

This evaluates all the elements of the list using parMap (the expensive
part, right?), and then sequentially applies the action on the current
thread.

You are.  I'm devoting most of my brain cells to automatic deriving of
TTypeable atm, but note that id is already strict, so (id $!) is
equivalent to id.

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


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

Reply via email to