fsprojects / FSharp.Azure.Storage

F# API for using Microsoft Azure Table Storage service
MIT License
75 stars 16 forks source link

allow task based async api #31

Closed coolya closed 5 years ago

coolya commented 5 years ago

Exposed a task based API in the new module Task. It uses TaskBuilder.fs for the computational expressions. The original API still works as before but calls into the task base API and then converts it into async workflows.

Especially in use cases where the calling code already uses tasks like for instance when using Giraffe it feels much more natural to have a task based API rather then converting the async workflows into tasks again. Since the API of the TableClient already exposes tasks the conversion from task to async only happens when caller is using Async or when using synchronous calls.

daniel-chambers commented 5 years ago

Thanks for the PR! I'm away this weekend, but I'll take a look next week when I'm home. :)

On Sat., 29 Sep. 2018, 8:56 am Kolja Dummann, notifications@github.com wrote:

Exposed a task based API in the new module Task. It uses TaskBuilder.fs for the computational expressions. The original API still works as before but calls into the task base API and then converts it into async workflows.

Especially in use cases where the calling code already uses tasks like for instance when using Giraffe it feels much more natural to have a task based API rather then converting the async workflows into tasks again. Since the API of the TableClient already exposes tasks the conversion from task to async only happens when caller is using Async or when using synchronous calls.

You can view, comment on, or merge this pull request online at:

https://github.com/fsprojects/FSharp.Azure.Storage/pull/31 Commit Summary

  • allow task based api

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fsprojects/FSharp.Azure.Storage/pull/31, or mute the thread https://github.com/notifications/unsubscribe-auth/ABKHkLDhQruvG5WEXspZOegbJyCPCkD-ks5ufqkdgaJpZM4XALS1 .

coolya commented 5 years ago

Thanks for the quick notice :) No need to hurry and have a nice weekend. 👍

coolya commented 5 years ago

I have reworked the fromTableAsync implementation to no longer use recursion. I don't really like the implementation because it is not really fsharp idiomatic and uses a mutable list to work around limitations of task builder but I guess it's the only way to get it working.