<div>Thank you very much for the help.</div>
<div>-- Peter</div>
<div><br><br> </div>
<div class="gmail_quote">On Thu, Nov 18, 2010 at 4:48 AM, Scott Turner <span dir="ltr"><<a href="mailto:1haskell@pkturner.org">1haskell@pkturner.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="im">On 2010-11-17 21:03, Peter Schmitz wrote:<br>> I am wondering how to generalize this to do likewise for a<br>> series of commands, where the varying args (filenames, in this<br>> case) are in a list ('inOutLeafs').<br>
<br></div>The 'sequence' function is handy for combining a series of actions, such<br>as [system cmd1, system cmd2, ...].<br>
<div class="im"><br>> I will also want to accumulate some results; probably just a<br>> failure count at this time.<br><br></div>'sequence' hangs on to the results. That may be what you need. For<br>control over accumulating results the good stuff is in Data.Foldable.<br>
<div class="im"><br>> Any advice or pointers to examples would be much appreciated.<br>><br>> Thanks in advance,<br>> -- Peter<br>><br>><br>>> run :: ... -> IO (Int) -- will return a fail count<br>
>> run<br>>> -- some args to this function here...<br>>> = do<br>>> -- ... set up: inputLeafs, outputLeafs, etc.<br>>><br>>> -- zip two lists of filenames:<br>>> let inOutLeafs = zip inputLeafs outputLeafs<br>
>><br>>> -- the first pair for the first command:<br>>> let (inFile1,outFile1) = head inOutLeafs<br>>><br>>> -- build 1st command using 1st pair of filenames:<br>>> let cmd1 = ...<br>
>><br>>> exitCode <- system cmd1<br>>> case (exitCode) of<br>>> ExitSuccess -> do<br>>> putStrLn $ "-- OK."<br>>> return 0<br>
>> ExitFailure failCnt -> do<br>>> putStrLn $ "-- Failed: " ++ show failCnt<br>>> return 1<br></div>> _______________________________________________<br>> Haskell-Cafe mailing list<br>
> <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>> <a href="http://www.haskell.org/mailman/listinfo/haskell-cafe" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
<br></blockquote></div><br>