kmcallister/spawn — pull request #1 by Peaker (2012-05-22 22:04:52+00:00)
Title: Hey kmc, added concurrently/concurrently_

Hey,

These may be somewhat trivial, but I think they're still useful generalizations of parMapIO/parMapIO_.

For example, I had something like this:

parMapIO doSomething
[ "a"
, "b"
, "c"
]

But then I realized that I may want to add a parameter to "doSomething". Doing this:

parMapIO (uncurry doSomething)
[ ("a", 1)
, ("b", 2)
, ("c", 3)
]

is possible, but not scalable to many params.

Instead, doing this:

concurrently
[ doSomething "a" 1
, doSomething "b" 2
, doSomething "c" 3
]

Is also a useful possibility.

I think parMapIO and parMapIO_ are somewhat analogous to mapM and mapM_, and concurrently/concurrently_ are analogous to sequence and sequence_, so it makes sense for the former to be defined in terms of the latter, so I changed that too.

What do you think?