<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">&lt;<a href="mailto:1haskell@pkturner.org">1haskell@pkturner.org</a>&gt;</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>&gt; I am wondering how to generalize this to do likewise for a<br>&gt; series of commands, where the varying args (filenames, in this<br>&gt; case) are in a list (&#39;inOutLeafs&#39;).<br>
<br></div>The &#39;sequence&#39; function is handy for combining a series of actions, such<br>as [system cmd1, system cmd2, ...].<br>
<div class="im"><br>&gt; I will also want to accumulate some results; probably just a<br>&gt; failure count at this time.<br><br></div>&#39;sequence&#39; 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>&gt; Any advice or pointers to examples would be much appreciated.<br>&gt;<br>&gt; Thanks in advance,<br>&gt; -- Peter<br>&gt;<br>&gt;<br>&gt;&gt; run :: ... -&gt; IO (Int)    -- will return a fail count<br>
&gt;&gt; run<br>&gt;&gt;    -- some args to this function here...<br>&gt;&gt;    = do<br>&gt;&gt;       -- ... set up: inputLeafs, outputLeafs, etc.<br>&gt;&gt;<br>&gt;&gt;       -- zip two lists of filenames:<br>&gt;&gt;       let inOutLeafs = zip inputLeafs outputLeafs<br>
&gt;&gt;<br>&gt;&gt;       -- the first pair for the first command:<br>&gt;&gt;       let (inFile1,outFile1) = head inOutLeafs<br>&gt;&gt;<br>&gt;&gt;       -- build 1st command using 1st pair of filenames:<br>&gt;&gt;       let cmd1 = ...<br>
&gt;&gt;<br>&gt;&gt;       exitCode &lt;- system cmd1<br>&gt;&gt;       case (exitCode) of<br>&gt;&gt;          ExitSuccess -&gt; do<br>&gt;&gt;             putStrLn $ &quot;-- OK.&quot;<br>&gt;&gt;             return 0<br>
&gt;&gt;          ExitFailure failCnt -&gt; do<br>&gt;&gt;             putStrLn $ &quot;-- Failed: &quot; ++ show failCnt<br>&gt;&gt;             return 1<br></div>&gt; _______________________________________________<br>&gt; Haskell-Cafe mailing list<br>
&gt; <a href="mailto:Haskell-Cafe@haskell.org">Haskell-Cafe@haskell.org</a><br>&gt; <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>