On 2008 Sep 24, at 17:44, Iain Barnett wrote:
On 24 Sep 2008, at 10:13 pm, Evan Laforge wrote:
For one approach, check
out 'replicate' to make copies of something, and then 'sequence' to
run them and return a list.
Thanks, I haven't found anything that explains 'sequence' well yet, but I'll keep looking.
sequence turns a list of monadic values into a monadic list of values, i.e. [m a] becomes m [a]. In IO, this is [IO a] -> IO [a]. This lets you do something like replicate an I/O action, then turn the list of I/O actions into a single I/O action on a list.