package async_kernel
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=01ced973dbc70535f692f38bed524ae82dba17e26e58791b2fbf0d647b160d2e
doc/async_kernel.eager_deferred/Eager_deferred/Memo/index.html
Module Eager_deferred.MemoSource
Memoization functions like in Core.Memo, with re-raising of exceptions thrown asynchronously.
Also see Lazy_deferred, of which Deferred.Memo.unit is a special case.
val general :
(module Core.Hashable.S_plain with type t = 'a) ->
('a -> 'b Async_kernel.Deferred.t) ->
('a -> 'b Async_kernel.Deferred.t) Core.Staged.tgeneral hashable f returns a memoized version of f, where the results are stored in a hash table indexed according to hashable. If f a asynchronously raises, then the error is stored in the hash table and is reraised when a is demanded.
Unlike Core.Memo.general, this general does not support cache_size_bound due to complexities of asynchrony -- even when one has a deferred return by the memoized function, there still may be asynchronous jobs working to determine it.
Unlike Core.Memo.general, this general takes a required Hashable module argument, to avoid unintentional use of polymorphic comparison.
val recursive :
(module Core.Hashable.S_plain with type t = 'a) ->
(('a -> 'b Async_kernel.Deferred.t) -> 'a -> 'b Async_kernel.Deferred.t) ->
('a -> 'b Async_kernel.Deferred.t) Core.Staged.tMemoize a recursive asynchronous function. See Memo.recursive for the introduction. We do not implement Async-aware dependency cycle detection, so if recursion is not well-founded then the computation will just deadlock.
val unit :
(unit -> 'a Async_kernel.Deferred.t) ->
(unit -> 'a Async_kernel.Deferred.t) Core.Staged.t