Thanks Daniel, that worked brilliantly.<br><br>I took yours  and Brent&#39;s advice and&nbsp;brought&nbsp;play&#39; and getNewAnimal&nbsp;out&nbsp;of&nbsp;the where block. Also,&nbsp;the line &quot;do ans &lt;- ask $ show question&quot; was probably there due to some of the previous code, in which case that line would have been slightly better (in my opinion, anyway), but I&#39;ve changed it now, because I prefer &quot;do ans &lt;- ask s&quot; too.<br>
<br>Thanks again.<br><br>- Alex<br><br><div><span class="gmail_quote">On 8/14/08, <b class="gmail_sendername">Daniel Fischer</b> &lt;<a href="mailto:daniel.is.fischer@web.de">daniel.is.fischer@web.de</a>&gt; wrote:</span><blockquote class="gmail_quote" style="margin-top: 0; margin-right: 0; margin-bottom: 0; margin-left: 0; margin-left: 0.80ex; border-left-color: #cccccc; border-left-width: 1px; border-left-style: solid; padding-left: 1ex">
Am Donnerstag, 14. August 2008 22:12 schrieb Alex Watt:<br><br>&gt; Brent: getChar acts like getLine from what I can tell, it&#39;s a bit odd<br> &gt;<br><br><br>Buffering indeed, in ghci, IIRC, stdin and stdout aren&#39;t buffered by default,<br>
 for binaries the default is line buffering, so the char won&#39;t be gotten until<br> you type a newline. Changing your code to<br><br> module Main where<br><br> import System.IO<br><br> main :: IO ()<br> main = do hSetBuffering stdin NoBuffering<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;play (Animal &quot;Dog&quot;)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return ()<br><br> solves the problem:<br><br> Think of an animal, I will try to guess what it is...<br> Are you thinking of a Dog? (y/n)<br> n<br> I give up, you win!<br>
 Please help me improve my guesses!<br> What is the name of the animal you were thinking of?<br> Cat<br> Now please enter a question that answers yes for a Cat and no for a Dog<br> Does it meow?<br><br>Do you want to play again? (y/n)<br>
 y<br><br>Think of an animal, I will try to guess what it is...<br> Does it meow? (y/n)<br> n<br> Are you thinking of a Dog? (y/n)<br> n<br> I give up, you win!<br> Please help me improve my guesses!<br> What is the name of the animal you were thinking of?<br>
 Cow<br> Now please enter a question that answers yes for a Cow and no for a Dog<br> Is it useful?<br><br>Do you want to play again? (y/n)<br> y<br><br>Think of an animal, I will try to guess what it is...<br> Does it meow? (y/n)<br>
 n<br> Is it useful? (y/n)<br> y<br> Are you thinking of a Cow? (y/n)<br> y<br> I win this time.<br><br>Do you want to play again? (y/n)<br><br>n<br> Thanks for playing..<br><br> On the other count, I have to agree with Brent, the code is very nice overall,<br>
 but play&#39; and getNewAnimal as top level functions would be better, and I<br> don&#39;t really like the line<br><br> play&#39; question@(Question s y n) = do ans &lt;- ask $ show question<br><br> I&#39;d prefer do ans &lt;- ask s<br>
<br> but that&#39;s purely a matter of taste.<br><br> HTH,<br><br>Daniel<br><br>_______________________________________________<br> Beginners mailing list<br> <a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
 <a href="http://www.haskell.org/mailman/listinfo/beginners">http://www.haskell.org/mailman/listinfo/beginners</a><br></blockquote></div><br>