timeout-with-results-0.1: Runs a time-limited computation alowing it to return intermediate results.

Safe HaskellSafe-Inferred




class Monad m => MonadTimeout w m | m -> w whereSource


tell :: w -> m ()Source

Save an intermediate result of the computation.

tellWith :: (Maybe w -> w) -> m ()Source

Combine an intermediate result of the computation with the current saved result (if any) and save it.

yield :: m ()Source

Explicitly allow interrupting the computation at this point. Experimental.


data Timeout w a Source




:: Strategy w

Evaluate values passed to tell using this strategy.

-> Int

Timeout in microseconds.

-> Timeout w ()

The computation.

-> IO (Maybe w)

The result, or Nothing if no tell was called by the computation.

Execute the given computation with a timeout limit and force the result to the form defined by the given Strategy.

returning :: MonadTimeout w m => m w -> m ()Source

Convert a monadic computation returning a value of the result type into 'm ()' so that it can be used with runTimeout. Calling 'returning k' is equivalent to 'k >>= tell'.