![]() |
VOOZH | about |
dotnet add package IcedTasks --version 0.11.9
NuGet\Install-Package IcedTasks -Version 0.11.9
<PackageReference Include="IcedTasks" Version="0.11.9" />
<PackageVersion Include="IcedTasks" Version="0.11.9" />Directory.Packages.props
<PackageReference Include="IcedTasks" />Project file
paket add IcedTasks --version 0.11.9
#r "nuget: IcedTasks, 0.11.9"
#:package IcedTasks@0.11.9
#addin nuget:?package=IcedTasks&version=0.11.9Install as a Cake Addin
#tool nuget:?package=IcedTasks&version=0.11.9Install as a Cake Tool
This library contains additional computation expressions for the task CE utilizing the Resumable Code introduced in F# 6.0.
ValueTask<'T> - This utilizes .NET's ValueTask (which is essentially a Discriminated Union of 'Value | Task<'Value>) for possibly better performance in synchronous scenarios. Similar to F#'s Task Expression
valueTaskvalueTaskUnitpoolingValueTaskColdTask<'T> - Alias for unit -> Task<'T>. Allows for lazy evaluation (also known as Cold) of the tasks, similar to F#'s Async being cold.
coldTaskCancellableTask<'T> - Alias for CancellationToken -> Task<'T>. Allows for lazy evaluation (also known as Cold) of the tasks, similar to F#'s Async being cold. Additionally, allows for flowing a CancellationToken through the computation, similar to F#'s Async cancellation support.
cancellableTaskcancellableBackgroundTaskCancellableValueTask<'T> - Alias for CancellationToken -> ValueTask<'T>. Allows for lazy evaluation (also known as Cold) of the tasks, similar to F#'s Async being cold. Additionally, allows for flowing a CancellationToken through the computation, similar to F#'s Async cancellation support.
cancellableValueTaskcancellablePoolingValueTaskParallelAsync<'T> - Utilizes the applicative syntax to allow parallel execution of Async<'T> expressions. See this discussion as to why this is a separate computation expression.
parallelAsyncAsyncEx<'T> - Variation of F# async semantics described further below with examples.
asyncExIcedTasks.Polyfill.Async which will shadow the F# Async CE.
asyncTask<'T> - Polyfill for fixes to F# Task CE. Can be accessed under IcedTasks.Polyfill.Task which will shadow the F# Task CE.
taskbackgroundTaskTask - a CE for a Task that has no return value.
taskUnitbackgroundTaskUnit| Computation Expression<sup>1</sup> | Library<sup>2</sup> | TFM<sup>3</sup> | Hot/Cold<sup>4</sup> | Multiple Awaits <sup>5</sup> | Multi-start<sup>6</sup> | Tailcalls<sup>7</sup> | CancellationToken propagation<sup>8</sup> | Cancellation checks<sup>9</sup> | Parallel when using and!<sup>10</sup> | use IAsyncDisposable <sup>11</sup> |
|---|---|---|---|---|---|---|---|---|---|---|
| F# Async | FSharp.Core | netstandard2.0 | Cold | Multiple | multiple | tailcalls | implicit | implicit | No | No |
| F# AsyncEx | IcedTasks | netstandard2.0 | Cold | Multiple | multiple | tailcalls | implicit | implicit | No | Yes |
| F# ParallelAsync | IcedTasks | netstandard2.0 | Cold | Multiple | multiple | tailcalls | implicit | implicit | Yes | No |
| F# Task/C# Task | FSharp.Core | netstandard2.0 | Hot | Multiple | once-start | no tailcalls | explicit | explicit | No | Yes |
| F# ValueTask | IcedTasks | netstandard2.0 | Hot | Once | once-start | no tailcalls | explicit | explicit | Yes | Yes |
| F# ColdTask | IcedTasks | netstandard2.0 | Cold | Multiple | multiple | no tailcalls | explicit | explicit | Yes | Yes |
| F# CancellableTask | IcedTasks | netstandard2.0 | Cold | Multiple | multiple | no tailcalls | implicit | implicit | Yes | Yes |
| F# CancellableValueTask | IcedTasks | netstandard2.0 | Cold | Once | multiple | no tailcalls | implicit | implicit | Yes | Yes |
let rec with the computation expression. See Tail call Recursion for more info.CancellationToken is propagated to all types the support implicit CancellatationToken passing. Calling cancellableTask { ... } nested inside async { ... } (or any of those combinations) will use the CancellationToken from when the code was started.use of IAsyncDisposable with the computation expression. See IAsyncDisposable for more info.AsyncEx is similar to Async except in the following ways:
Allows use for IAsyncDisposable
open IcedTasks
let fakeDisposable () = { new IAsyncDisposable with member __.DisposeAsync() = ValueTask.CompletedTask }
let myAsyncEx = asyncEx {
use _ = fakeDisposable ()
return 42
}
Allows let!/do! against Tasks/ValueTasks/any Awaitable
open IcedTasks
let myAsyncEx = asyncEx {
let! _ = task { return 42 } // Task<T>
let! _ = valueTask { return 42 } // ValueTask<T>
let! _ = Task.Yield() // YieldAwaitable
return 42
}
When Tasks throw exceptions they will use the behavior described in Async.Await overload (esp. AwaitTask without throwing AggregateException
let data = "lol"
let inner = asyncEx {
do!
task {
do! Task.Yield()
raise (ArgumentException "foo")
return data
}
:> Task
}
let outer = asyncEx {
try
do! inner
return ()
with
| :? ArgumentException ->
// Should be this exception and not AggregationException
return ()
| ex ->
return raise (Exception("Should not throw this type of exception", ex))
}
Use IAsyncEnumerable with for keyword. This example uses TaskSeq but you can use any IAsyncEnumerable<T>.
open IcedTasks
open FSharp.Control
let myAsyncEx = asyncEx {
let items = taskSeq { // IAsyncEnumerable<T>
yield 42
do! Task.Delay(100)
yield 1701
}
let mutable sum = 0
for i in items do
sum <- sum + i
return sum
}
valueTask computation expression. Until this PR is merged.open IcedTasks
let myValueTask = task {
let! theAnswer = valueTask { return 42 }
return theAnswer
}
Short example:
open IcedTasks
let coldTask_dont_start_immediately = task {
let mutable someValue = null
let fooColdTask = coldTask { someValue <- 42 }
do! Async.Sleep(100)
// ColdTasks will not execute until they are called, similar to how Async works
Expect.equal someValue null ""
// Calling fooColdTask will start to execute it
do! fooColdTask ()
Expect.equal someValue 42 ""
}
The examples show cancellableTask but cancellableValueTask can be swapped in.
Accessing the context's CancellationToken:
Binding against CancellationToken -> Task<_>
let writeJunkToFile =
let path = Path.GetTempFileName()
cancellableTask {
let junk = Array.zeroCreate bufferSize
use file = File.Create(path)
for i = 1 to manyIterations do
// You can do! directly against a function with the signature of `CancellationToken -> Task<_>` to access the context's `CancellationToken`. This is slightly more performant.
do! fun ct -> file.WriteAsync(junk, 0, junk.Length, ct)
}
Binding against CancellableTask.getCancellationToken
let writeJunkToFile =
let path = Path.GetTempFileName()
cancellableTask {
let junk = Array.zeroCreate bufferSize
use file = File.Create(path)
// You can bind against `CancellableTask.getCancellationToken` to get the current context's `CancellationToken`.
let! ct = CancellableTask.getCancellationToken ()
for i = 1 to manyIterations do
do! file.WriteAsync(junk, 0, junk.Length, ct)
}
Short example:
let executeWriting = task {
// CancellableTask is an alias for `CancellationToken -> Task<_>` so we'll need to pass in a `CancellationToken`.
// For this example we'll use a `CancellationTokenSource` but if you were using something like ASP.NET, passing in `httpContext.RequestAborted` would be appropriate.
use cts = new CancellationTokenSource()
// call writeJunkToFile from our previous example
do! writeJunkToFile cts.Token
}
Short example:
open IcedTasks
let exampleHttpCall url = async {
// Pretend we're executing an HttpClient call
return 42
}
let getDataFromAFewSites = parallelAsync {
let! result1 = exampleHttpCall "howManyPlantsDoIOwn"
and! result2 = exampleHttpCall "whatsTheTemperature"
and! result3 = exampleHttpCall "whereIsMyPhone"
// Do something meaningful with results
return ()
}
| GitHub Actions |
|---|
| 👁 GitHub Actions |
| 👁 Build History |
| Package | Stable | Prerelease |
|---|---|---|
| IcedTasks | 👁 NuGet Badge |
👁 NuGet Badge |
Make sure the following requirements are installed on your system:
or
CONFIGURATION will set the configuration of the dotnet commands. If not set, it will default to Release.
CONFIGURATION=Debug ./build.sh will result in -c additions to commands such as in dotnet build -c DebugGITHUB_TOKEN will be used to upload release notes and Nuget packages to GitHub.
> build.cmd <optional buildtarget> // on windows
$ ./build.sh <optional buildtarget>// on unix
The bin of your library should look similar to:
$ tree src/MyCoolNewLib/bin/
src/MyCoolNewLib/bin/
└── Debug
└── net50
├── MyCoolNewLib.deps.json
├── MyCoolNewLib.dll
├── MyCoolNewLib.pdb
└── MyCoolNewLib.xml
Clean - Cleans artifact and temp directories.DotnetRestore - Runs dotnet restore on the solution file.DotnetBuild - Runs dotnet build on the solution file.DotnetTest - Runs dotnet test on the solution file.GenerateCoverageReport - Code coverage is run during DotnetTest and this generates a report via ReportGenerator.WatchTests - Runs dotnet watch with the test projects. Useful for rapid feedback loops.GenerateAssemblyInfo - Generates AssemblyInfo for libraries.DotnetPack - Runs dotnet pack. This includes running Source Link.SourceLinkTest - Runs a Source Link test tool to verify Source Links were properly generated.PublishToNuGet - Publishes the NuGet packages generated in DotnetPack to NuGet via paket push.GitRelease - Creates a commit message with the Release Notes and a git tag via the version in the Release Notes.GitHubRelease - Publishes a GitHub Release with the Release Notes and any NuGet packages.FormatCode - Runs Fantomas on the solution file.BuildDocs - Generates Documentation from docsSrc and the XML Documentation Comments from your libraries in src.WatchDocs - Generates documentation and starts a webserver locally. It will rebuild and hot reload if it detects any changes made to docsSrc files, libraries in src, or the docsTool itself.ReleaseDocs - Will stage, commit, and push docs generated in the BuildDocs target.Release - Task that runs all release type tasks such as PublishToNuGet, GitRelease, ReleaseDocs, and GitHubRelease. Make sure to read Releasing to setup your environment correctly for releases.git add .
git commit -m "Scaffold"
git remote add origin https://github.com/user/MyCoolNewLib.git
git push -u origin master
paket config add-token "https://www.nuget.org" 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a
NUGET_TOKEN to your keyGITHUB_TOKEN to upload release notes and artifacts to githubThen update the CHANGELOG.md with an "Unreleased" section containing release notes for this version, in KeepAChangelog format.
NOTE: Its highly recommend to add a link to the Pull Request next to the release note that it affects. The reason for this is when the RELEASE target is run, it will add these new notes into the body of git commit. GitHub will notice the links and will update the Pull Request with what commit referenced it saying "added a commit that referenced this pull request". Since the build script automates the commit message, it will say "Bump Version to x.y.z". The benefit of this is when users goto a Pull Request, it will be clear when and which version those code changes released. Also when reading the CHANGELOG, if someone is curious about how or why those changes were made, they can easily discover the work and discussions.
Here's an example of adding an "Unreleased" section to a CHANGELOG.md with a 0.1.0 section already released.
## [Unreleased]
### Added
- Does cool stuff!
### Fixed
- Fixes that silly oversight
## [0.1.0] - 2017-03-17
First release
### Added
- This release already has lots of features
[Unreleased]: https://github.com/user/MyCoolNewLib.git/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/user/MyCoolNewLib.git/releases/tag/v0.1.0
Release target, specifying the version number either in the RELEASE_VERSION environment
variable, or else as a parameter after the target name. This will:
CHANGELOG.md, moving changes from the Unreleased section into a new 0.2.0 section
Bump version to 0.2.0 and adds the new changelog section to the commit's bodymacOS/Linux Parameter:
./build.sh Release 0.2.0
macOS/Linux Environment Variable:
RELEASE_VERSION=0.2.0 ./build.sh Release
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 is compatible. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 was computed. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 is compatible. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 is compatible. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 was computed. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on IcedTasks:
| Package | Downloads |
|---|---|
|
FsToolkit.ErrorHandling.IcedTasks
FsToolkit.ErrorHandling is an extensive utility library based around the F# Result type, enabling consistent and powerful error handling. |
|
|
Perla.Plugins
A Library under the Perla umbrella. This package gives you a a set of types that can be used to generate Perla Perla Dev Server plugins. Use the types here to transform non-supported files for browsers into either HTML/CSS/JS |
|
|
Migrondi.Core
This is the core library for the Migrondi CLI, you can use this library to run the same functionality of Migrondi as part of your source code or to write an abstraction for different kind of tools. |
|
|
Perla.PkgManager
A Library under the Perla umbrella. This package provides a small Package Manager API to interact with the JSPM API to produce ImportMaps and and take them offline. It also powers the package management and importmap features of the Perla Dev Server. |
|
|
Navs
Package Description |
Showing the top 1 popular GitHub repositories that depend on IcedTasks:
| Repository | Stars |
|---|---|
|
App-vNext/Polly
Polly is a .NET resilience and transient-fault-handling library that allows developers to express policies such as Retry, Circuit Breaker, Timeout, Bulkhead Isolation, and Fallback in a fluent and thread-safe manner. From version 6.0.1, Polly targets .NET Standard 1.1 and 2.0+.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 0.11.9 | 24,971 | 9/5/2025 |
| 0.11.9-beta001 | 215 | 9/5/2025 |
| 0.11.8 | 245,515 | 5/5/2025 |
| 0.11.7 | 68,175 | 7/11/2024 |
| 0.11.6 | 1,391 | 5/8/2024 |
| 0.11.5 | 3,414 | 4/22/2024 |
| 0.11.4 | 24,812 | 4/6/2024 |
| 0.11.3 | 2,051 | 2/7/2024 |
| 0.11.2 | 476 | 2/7/2024 |
| 0.11.0 | 1,027 | 1/31/2024 |
| 0.10.2 | 717 | 1/29/2024 |
| 0.10.0 | 18,561 | 11/22/2023 |
| 0.9.2 | 7,888 | 11/9/2023 |
| 0.9.1 | 425 | 11/8/2023 |
| 0.9.0 | 475 | 11/6/2023 |
| 0.8.5 | 1,060 | 10/29/2023 |
| 0.8.5-beta001 | 245 | 10/28/2023 |
| 0.8.4 | 434 | 10/28/2023 |
| 0.8.3 | 448 | 10/27/2023 |
| 0.8.2 | 684 | 10/23/2023 |
## [0.11.9] - 2025-09-05
[0.11.9]: https://github.com/TheAngryByrd/IcedTasks//compare/v0.11.8...v0.11.9
### Changed
- [Update FSharp.Core package reference to stable version 9.0.300](https://github.com/TheAngryByrd/IcedTasks/commit/131da45b5a82e259d1b8a041d21e837db3bd0631) - Credits @TheAngryByrd