<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Announcing Silently, a package with two simple functions to run an IO action while preventing it from writing to stdout (or the given handle):<div><br><div>&nbsp;&nbsp;silently :: IO a -&gt; IO a</div><div>&nbsp;&nbsp;hSilently :: Handle -&gt; IO a -&gt; IO a</div></div><div><br></div><div>An example in GHCI:</div><div><br></div><div><span class="Apple-style-span" style="font-family: helvetica, arial, freesans, clean, sans-serif; font-size: 13px; line-height: 18px; "><pre style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; line-height: 1.4em; font-family: 'Bitstream Vera Sans Mono', Courier, monospace; font-size: 11px; color: rgb(68, 68, 68); white-space: pre-wrap; word-wrap: break-word; width: 74em; ">Prelude&gt; :m + System.IO.Silently
Prelude System.IO.Silently&gt; let printFail s = undefined :: IO()
Prelude System.IO.Silently&gt; let test1 = print 1 &gt;&gt; silently (print 2) &gt;&gt; print 3
Prelude System.IO.Silently&gt; let test2 = print 1 &gt;&gt; silently (printFail 2) &gt;&gt; print 3
Prelude System.IO.Silently&gt; test1
1
3
Prelude System.IO.Silently&gt; test2
1
*** Exception: Prelude.undefined
Prelude System.IO.Silently&gt; print "stdout still works after exceptions"
"stdout still works after exceptions"</pre></span><div><br></div></div><div><a href="http://hackage.haskell.org/package/silently">http://hackage.haskell.org/package/silently</a></div><div><a href="https://github.com/trystan/silently">https://github.com/trystan/silently</a></div><div><br></div><div>Any advice, comments, or questions are welcome,</div><div>Trystan Spangler</div></body></html>