package miou

  1. Overview
  2. Docs

Module Miou.LazySource

Sourceexception Undefined
Sourcetype !'a t

Represents a deferred computation of suspension.

Sourceval from_val : 'a -> 'a t

from_val value returns an already forced suspension whose result is the given value.

Sourceval from_fun : (unit -> 'a) -> 'a t

from_fun fn returns a suspension.

Sourceval force : 'a t -> 'a

force t forces the suspension, i.e. computes fn () using the fn passed to from_fun, stores the result of the computation to the suspension and reproduces its result. In case the suspension has already been forced the computation is skipped and stored result is reproduced.

  • raises Undefined

    in case the suspension is currently being forced by the current promise.