Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. F#
  3. TaskBuilder.fs

TaskBuilder.fs

CC0-1.0F#

An F# computation expression builder for writing System.Threading.Tasks with C# async/await-like syntax and behavior.

GitHubGitHub
235 stars27 forks0 contributors

What is TaskBuilder.fs?

TaskBuilder.fs is an F# computation expression builder for System.Threading.Tasks that enables F# developers to write asynchronous code with syntax and behavior identical to C#'s async/await pattern. It solves the friction of converting between F#'s native Async type and the .NET standard Task model, providing a more intuitive experience for developers familiar with C# asynchronous programming.

Target Audience

F# developers working in .NET ecosystems where Task is the standard, especially those integrating with C# libraries or teams. It's also suitable for developers writing library or server-side code who need performance optimizations like automatic ConfigureAwait(false).

Value Proposition

Developers choose TaskBuilder.fs because it offers C#-like async/await syntax in F# with minimal overhead, broad awaitable support, and a single-file public domain implementation. It provides better performance than alternatives like Task.ContinueWith or Async.StartAsTask while maintaining exact behavioral compatibility with C# tasks.

Overview

F# computation expression builder for System.Threading.Tasks

Use Cases

Best For

  • Writing F# asynchronous code that must behave identically to C# async/await methods for interoperability.
  • Integrating F# projects with .NET libraries and APIs that use Task as the standard asynchronous model.
  • Developing library or server-side F# code where automatic ConfigureAwait(false) can improve performance.
  • F# developers familiar with C# who want a more intuitive asynchronous programming experience without manual Async/Task conversions.
  • Projects requiring minimal dependencies, as TaskBuilder.fs is a single-file public domain implementation that can be copied directly.
  • Binding any awaitable type in F# that has GetAwaiter(), GetResult(), and IsCompleted methods using let! syntax.

Not Ideal For

  • Projects that heavily rely on tail recursion for asynchronous operations, as TaskBuilder.fs does not optimize tail calls unlike F#'s native Async builder.
  • Teams preferring pure functional programming styles where F#'s Async type offers better immutability and composability than Task semantics.
  • Applications where minimizing every bit of performance overhead is critical, since TaskBuilder.fs has a slight performance penalty compared to C# compiler-generated code.
  • Development environments strictly using F#-specific tooling or libraries built around the Async type, not Task.

Pros & Cons

Pros

C#-Like Syntax

Provides a computation expression that mirrors C#'s async/await exactly, reducing friction for developers familiar with C# asynchronous programming, as shown in the README's side-by-side examples.

Context-Insensitive Optimization

Offers an optional builder that automatically applies ConfigureAwait(false) for improved performance in library or server-side code, addressing common optimization needs without manual code changes.

Broad Awaitable Support

Can bind any type with GetAwaiter(), GetResult(), and IsCompleted methods using let!, allowing seamless integration with various .NET asynchronous patterns beyond standard Tasks.

Minimal Overhead Implementation

As a single-file, public domain codebase, it can be copied directly into projects with no dependencies, simplifying adoption and reducing deployment complexity.

Cons

No Tail Call Optimization

The README explicitly states that tail recursion is not supported, which limits idiomatic F# coding patterns and requires workarounds like while loops for asynchronous loops.

Performance Overhead

Admits a small performance hit compared to C# compiler-generated state machines due to its general-purpose design, which might affect high-throughput applications.

Binary Compatibility Challenges

The inclusion of V2 modules indicates past issues with compiler version compatibility, potentially complicating upgrades or integrations in mixed-version environments.

Frequently Asked Questions

Quick Stats

Stars235
Forks27
Contributors0
Open Issues6
Last commit5 years ago
CreatedSince 2016

Tags

#public-domain#async-programming#async#asynchronous#dotnet#concurrency#await#fsharp#computation-expressions#task

Built With

F
F#
.
.NET

Included in

F#1.4k
Auto-fetched 1 day ago

Related Projects

HopacHopac

http://hopac.github.io/Hopac/Hopac.html

Stars536
Forks62
Last commit4 years ago
PlyPly

High performance System.Threading.(Value)Task computation expressions for F#

Stars246
Forks17
Last commit3 years ago
FSharp.Control.AsyncSeqFSharp.Control.AsyncSeq

Asynchronous sequences for F#

Stars174
Forks54
Last commit22 days ago
FSharp.Control.FusionTasksFSharp.Control.FusionTasks

F# Async workflow <--> .NET Task/ValueTask easy seamless interoperability library.

Stars160
Forks13
Last commit3 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub