FSharp.Control.AsyncSeq is a collection of asynchronous programming utilities for F#.
An AsyncSeq<'T> is a sequence in which individual elements are retrieved using an Async computation.
The power of AsyncSeq lies in that many of these operations also have analogs based on Async
allowing composition of complex asynchronous workflows, including compositional cancellation.
v4.0:
AsyncSeq<'T>is now a type alias forSystem.Collections.Generic.IAsyncEnumerable<'T>. Values flow freely betweenAsyncSeq<'T>andIAsyncEnumerable<'T>without any conversion.AsyncSeq.ofAsyncEnum/AsyncSeq.toAsyncEnumare now no-ops and marked obsolete — remove them. See the README for migration notes.
An AsyncSeq<'a> can be generated using computation expression syntax much like seq<'a>:
let oneThenTwo = asyncSeq {
yield 1
do! Async.Sleep 1000 // non-blocking sleep
yield 2
}
AsyncSeq contains narrative and code samples explaining asynchronous sequences.
AsyncSeq Examples contains examples.
Terminology a reference for some of the terminology around F# async.
Comparison with IObservable contains discussion about the difference between async sequences and IObservables.
API Reference contains automatically generated documentation for all types, modules and functions in the library. This includes additional brief samples on using most of the functions.
The project is hosted on GitHub where you can report issues, fork the project and submit pull requests. If you're adding a new public API, please also consider adding samples that can be turned into a documentation. You might also want to read the library design notes to understand how it works.
The library is available under Apache 2.0 license, which allows modification and redistribution for both commercial and non-commercial purposes. For more information see the License file in the GitHub repository.