<div dir="ltr"><div>Of course there is &quot;return ()&quot; missing.<br><br><span style="font-family:courier new,monospace">check x assoc = case lookup x of<br></span><span style="font-family:courier new,monospace">                    Just found -&gt; putStrLn (&quot;found &quot; ++ found)<br>

</span></div><span style="font-family:courier new,monospace">
                    _ -&gt; return ()</span><br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Aug 1, 2013 at 5:34 PM, Krzysztof Skrzętnicki <span dir="ltr">&lt;<a href="mailto:gtener@gmail.com" target="_blank">gtener@gmail.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>I&#39;d rather use pattern matching in this case:<br><br></div><span style="font-family:courier new,monospace">check x assoc = case lookup x of<br>

</span></div><span style="font-family:courier new,monospace">                    Just found -&gt; putStrLn (&quot;found &quot; ++ found)<br>
                    _ -&gt; </span><br><br></div>Not really shorter but I think it&#39;s cleaner this way.<br><div><div><br><br></div></div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><br><div class="gmail_quote">

On Thu, Aug 1, 2013 at 5:00 PM, vold <span dir="ltr">&lt;<a href="mailto:voldermort@hotmail.com" target="_blank">voldermort@hotmail.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&#39;ve defined a function similar to<br>
<br>
check x assoc = let found = lookup x assoc in<br>
                    when (isJust found) $ putStrLn $ &quot;found &quot; ++ fromJust found<br>
<br>
which I&#39;ve used several times from within the IO monad. Is there a more<br>
compact way of doing this?<br>
<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org" target="_blank">Beginners@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/beginners" target="_blank">http://www.haskell.org/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div>