An experimental library for lazy promises that can be evaluated in pure code.
Evaluation of a promise before its thread completes results in an
indefinite block. This is accomplished by the use of
Thus, care should be taken in using this library, since it couples the
execution time of pure code with an arbitrary IO computation.
Using System.Timeout from the timeout package can help to ensure that
forcing a promise is always well-defined.
For safer implementations of promises, see Control.Concurrent.Spawn from the spawn package, and Control.Concurrent.Future from the future package.
Forks an IO computation as a thread and immediately returns a lazy future. Evaluating the future before the thread completes causes it to wait for a result. If the thread halts with a thrown exception, then evaluating the future will re-throw the exception.
Creating lists of promises
Forks a sequence of IO computations in multiple threads, and immediately returns a list of futures. The order of the futures is determined by the order in which the threads terminate. If an exception is thrown by the list of threads, then the exception is re-thrown when its corresponding future is evaluated.