[Haskell] ANN: io-memoize 1.1
Dan Burton
danburton.email at gmail.com
Thu Jun 12 09:47:54 UTC 2014
Have you ever wanted to restrict an IO action such that it could only be
invoked once? Now you can with System.IO.Memoize.once (formerly known as
ioMemo).
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" Control.Concurrent.Cache api for fun and profit.
1. Create an empty cache with newCache
2. fetch repeatedly from the cache, each time providing a fallback in case
it is empty.
3. There is no step 3.
Fetching from a Cache 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.
-- Dan Burton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell/attachments/20140612/a530346c/attachment.html>
More information about the Haskell
mailing list