The following property holds:
join . once === id.
The same is true for
The memory allocated for a memoized result will obviously not be available for garbage collection until the corresponding memoized action is also available for garbage collection.
Memoize an IO action. The action will be performed the first time that it its value is demanded; all subsequent invocations will simply recall the value acquired from the first call. If the value is never demanded, then the action will never be performed.
This is basically a safe version of
Exceptions will be propagated to the caller, and the action will be retried
at each invocation, only until it has successfully completed once.
getLine' <- once getLine
replicateM 3 getLine'Hello ["Hello", "Hello", "Hello"]
Memoize an IO action. The action will be started immediately in a new thread. Attempts to access the result will block until the action is finished. If the action produces an error, then attempts to access its value will re-raise the same error each time.
Deprecated: Please just call the action directly.
Memoize an IO action. The action will be performed immediately; all subsequent invocations will recall the value acquired.