Source

planck / smemo.mli

Full commit
(** Extend(Base) extends Base with memoization over each stream element.
    Typical usage is:

    module MyStream = struct
      module Base = ... (* creation of Base *)
      include Base
      include Smemo.Extend(Base)
    end
*)

type memo_result = (Obj.t, exn) Result.t
    
module Extend(Base : sig
  include Stream_intf.S
  module Memo : Hashtbl.S
  val memo : t -> memo_result Memo.t
end) : sig
  open Base
  val memoize : Memo.key -> (t -> 'a) -> t -> 'a
end