TaskBuilder.fs icon indicating copy to clipboard operation
TaskBuilder.fs copied to clipboard

Added generic overload of TaskBuilderV2.For method

Open SLAVONchick opened this issue 5 years ago • 0 comments

This PR solves problem of iterating over sequences that don't implement IEnumerable<'T>, e.g. System.Buffers.ReadOnlySequence<'T>.

After applying the changes you should be able to compile code like this:

open System.Text
open System.Buffers
open FSharp.Control.Tasks.V2

let readFromSequence (seq: ReadOnlySequence<byte>) = task {
    for segment in seq do 
        printfn "%s" <| Encoding.UTF8.GetString segment.Span
}

Please, @rspeele, give some feedback.

SLAVONchick avatar May 16 '20 14:05 SLAVONchick