Seems like you&#39;d want x &lt;- getArgs and x == [&quot;debug&quot;] rather than the irrefutable pattern match.<br><br><div class="gmail_quote">On Sun, Dec 26, 2010 at 3:04 PM, Michael Snoyman <span dir="ltr">&lt;<a href="mailto:michael@snoyman.com">michael@snoyman.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">I think something like this would work:<br>
<br>
myFlag = unsafePerformIO $ do<br>
    [x] &lt;- getArgs<br>
    return $ x == &quot;debug&quot;<br>
<br>
In general, unsafePerformIO should be avoided, but this is one of<br>
those situations where we can give you a pass ;).<br>
<font color="#888888"><br>
Michael<br>
</font><div><div></div><div class="h5"><br>
On Sun, Dec 26, 2010 at 9:53 PM,  &lt;<a href="mailto:briand@aracnet.com">briand@aracnet.com</a>&gt; wrote:<br>
&gt; Hi,<br>
&gt;<br>
&gt; I have a program with a debug flag in it (Strangely I&#39;ve yet to be<br>
&gt; able to write bug-free code).  I&#39;d like to change the state of the<br>
&gt; debug flag based on command line args.<br>
&gt;<br>
&gt; I looked at IOVar but that would cause all the pure procedures to get<br>
&gt; swallowed by the IO Monad.<br>
&gt;<br>
&gt; Is a better way to get this behavior ?<br>
&gt;<br>
&gt; Thanks,<br>
&gt;<br>
&gt; Brian<br>
&gt;<br>
&gt;<br>
&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>
&gt;<br>
<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" target="_blank">http://www.haskell.org/mailman/listinfo/haskell-cafe</a><br>
</div></div></blockquote></div><br>