Module Async.Interval

Parameters

Signature

val forever : ms:int -> int t

Creates an infinite async stream that enumerates the natural numbers every ms.

If this stream is converted to a finite stream with Lambda_streams.Finite.Async.take' it will still be considered active (the interval will not be cleared). It will just stop sending signals after whatever n was passed to take'.

To get an infinite async stream that can be converted later into a finite stream that ends, use make and pass the output stream that closes it to Lambda_streams.Finite.Async.take'.

val make : ms:int -> int connection

Creates an async stream that enumerates the natural numbers every ms. This is a connection-based version that get closed (no more signals are sent) when the output stream is called.