HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

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