<div dir="ltr"><div>Have you ever wanted to restrict an IO action such that it could only be invoked once? Now you can with <font face="courier new, monospace">System.IO.Memoize.once </font>(formerly known as <font face="courier new, monospace">ioMemo</font>).</div>

<div><br></div><div>Need slightly more complicated logic? (e.g. An IO callback that takes an argument but then only executes the first time around, essentially ignoring the argument the other times it is called.) Leverage the dead simple "write once"  <font face="courier new, monospace">Control.Concurrent.Cache</font> api for fun and profit.</div>

<div><br></div><div>1. Create an empty cache with <font face="courier new, monospace">newCache</font></div><div>2. <font face="courier new, monospace">fetch</font> repeatedly from the cache, each time providing a fallback in case it is empty.</div>

<div>3. There is no step 3.</div><div><br></div><div>Fetching from a <font face="courier new, monospace">Cache</font> is thread safe: only one "fallback" will execute at a time, and after the first successful fallback, the cached value will be set and no other fallbacks will be called.</div>

<br clear="all"><div>-- Dan Burton</div>
</div>