[Haskell-cafe] operating on a hundred files at once
jeff at renci.org
Mon Apr 9 21:24:30 EDT 2007
It is indeed! Is that to be found in Control.Monad, I take it?
On Tue, 2007-04-10 at 08:50 +1000, Duncan Coutts wrote:
> On Mon, 2007-04-09 at 14:40 -0400, Jefferson Heard wrote:
> > Thanks for the advice. I'm not so much interested in performance here,
> > as this is just a one-off. Disk thrashing or not, these files are only
> > a few hundred K apiece, and I can't imagine that the whole computation
> > will take more than a few minutes.
> > My question is more about how to deal with the IO monad "pollution" of
> > all the data in a situation where you have N instances of IO [a] at step
> > 1, and you have M computations to perform on those instances, which are
> > all monad-free.
> Perhaps you want one of these functions:
> sequence :: Monad m => [m a] -> m [a]
> sequence_ :: Monad m => [m a] -> m ()
> for example in the case of IO it's:
> sequence :: [IO a] -> IO [a]
> sequence_ :: [IO a] -> IO ()
> ie it takes a pure list of IO actions and sticks them together into one
> IO action, or to put it another way, it performs all the actions in
> Is this what you meant?
More information about the Haskell-Cafe