Matt,<br><br>&gt; should finish evaluating when either the timer has run out or<br>I recommend changing my implementation of hReadUntilStr so that the deadline is calculated upfront (have a look at System.Time), and then reducing the number of milliseconds for hReadUntilChar with each call to it.
<br><br>Thanks,<br>Greg<br><br><br><div><span class="gmail_quote">On 2/4/07, <b class="gmail_sendername">Matt Revelle</b> &lt;<a href="mailto:mrevelle@gmail.com">mrevelle@gmail.com</a>&gt; wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Thanks for the responses.<br><br>Greg, your implementation looks useful but it&#39;s a little different<br>than what I was thinking (my apologies, I wasn&#39;t very clear).<br><br>In the implementation you posted, the timeout parameter is used to
<br>limit the amount of time spent waiting to read an individual character<br>- I was hoping to use the timeout as an initial value for a timer that<br>should start running when hReadUntilStr is evaluated and the function
<br>should finish evaluating when either the timer has run out or when the<br>string match has been found.<br><br>Martin, thanks for the link.<br><br>Cheers,<br>Matt<br><br><br>On 2/3/07, Greg Fitzgerald &lt;<a href="mailto:garious@gmail.com">
garious@gmail.com</a>&gt; wrote:<br>&gt; Hi Matt,<br>&gt;<br>&gt; &gt; hReadUntilStr - that is, a function that takes a Handle as an input<br>&gt; &gt; source, a String to match, and a &quot;Num a&quot;&nbsp;&nbsp;as the number of seconds to
<br>&gt; &gt; wait before returning a (String, Bool) where the String is all the<br>&gt; &gt; text read from the Handle until either matching or timing out and the<br>&gt; &gt; Bool is true if the input String was matched
<br>&gt;<br>&gt; This might work for you: <a href="http://hpaste.org/289">http://hpaste.org/289</a> .<br>&gt;<br>&gt; It throws an IO exception if hWaitForChar times out, and makes use of lazy<br>&gt; evaluation to schedule all the IO upfront so that grabbing the string prefix
<br>&gt; can be done in pure code.<br>&gt;<br>&gt; Thanks,<br>&gt; Greg<br>&gt;<br>_______________________________________________<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">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br></blockquote></div><br>