HORIZON HASKELLDocslts/ghc-9.14.x6d5fdfd2026-10-12Search packagesCtrl K
Theme: |

GHC 9.14.1 · lts/ghc-9.14.x · 6d5fdfd · 2026-10-12

Moduleunliftio-0.2.25.1Haskell2010

UnliftIO.Memoize

Memoize the results of actions. In other words: actions will be run once, on demand, and their results saved.

Exceptions semantics: if a synchronous exception is thrown while performing the computation, that result will be saved and rethrown each time runMemoized is called subsequently.'

Synopsis
newtypenewtype Memoized a

A "run once" value, with results saved. Extract the value with runMemoized. For single-threaded usage, you can use memoizeRef to create a value. If you need guarantees that only one thread will run the action at a time, use memoizeMVar.

Note that this type provides a Show instance for convenience, but not useful information can be provided.

Instances4Monad, Functor, Applicative, Show