IcedTasks 0.3.1-beta001
See the version list below for details.
dotnet add package IcedTasks --version 0.3.1-beta001
NuGet\Install-Package IcedTasks -Version 0.3.1-beta001
<PackageReference Include="IcedTasks" Version="0.3.1-beta001" />
paket add IcedTasks --version 0.3.1-beta001
#r "nuget: IcedTasks, 0.3.1-beta001"
// Install IcedTasks as a Cake Addin #addin nuget:?package=IcedTasks&version=0.3.1-beta001&prerelease // Install IcedTasks as a Cake Tool #tool nuget:?package=IcedTasks&version=0.3.1-beta001&prerelease
IcedTasks
What
This library contains additional computation expressions for the task CE utilizing the Resumable Code introduced in F# 6.0.
ColdTask<'T>
- Alias forunit -> Task<'T>
. Allows for lazy evaluation (also known as Cold) of the tasks, similar to F#'s Async being cold.CancellableTask<'T>
- Alias forCancellationToken -> 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.ParallelAsync<'T>
. Utilizes the applicative syntax to allow parallel execution of Async<'T> expressions.
How
ColdTask
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 ""
}
CancellableTask
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
}
ParallelAsync
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 ()
}
Builds
GitHub Actions |
---|
NuGet
Package | Stable | Prerelease |
---|---|---|
IcedTasks |
Developing
Make sure the following requirements are installed on your system:
- dotnet SDK 6.0 or higher
or
Environment Variables
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 indotnet build -c Debug
GITHUB_TOKEN
will be used to upload release notes and Nuget packages to GitHub.- Be sure to set this before releasing
DISABLE_COVERAGE
Will disable running code coverage metrics. AltCover can have severe performance degradation so it's worth disabling when looking to do a quicker feedback loop.DISABLE_COVERAGE=1 ./build.sh
Building
> 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
Build Targets
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 duringDotnetTest
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 inDotnetPack
to NuGet via paket push.GitRelease
- Creates a commit message with the Release Notes and a git tag via the version in theRelease Notes
.GitHubRelease
- Publishes a GitHub Release with the Release Notes and any NuGet packages.FormatCode
- Runs Fantomas on the solution file.BuildDocs
- Generates Documentation fromdocsSrc
and the XML Documentation Comments from your libraries insrc
.WatchDocs
- Generates documentation and starts a webserver locally. It will rebuild and hot reload if it detects any changes made todocsSrc
files, libraries insrc
, or thedocsTool
itself.ReleaseDocs
- Will stage, commit, and push docs generated in theBuildDocs
target.Release
- Task that runs all release type tasks such asPublishToNuGet
,GitRelease
,ReleaseDocs
, andGitHubRelease
. Make sure to read Releasing to setup your environment correctly for releases.
Releasing
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
- or set the environment variable
NUGET_TOKEN
to your key
- or set the environment variable
-
- You can then set the environment variable
GITHUB_TOKEN
to upload release notes and artifacts to github - Otherwise it will fallback to username/password
- You can then set the environment variable
Then 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
- You can then use the
Release
target, specifying the version number either in theRELEASE_VERSION
environment variable, or else as a parameter after the target name. This will:- update
CHANGELOG.md
, moving changes from theUnreleased
section into a new0.2.0
section- if there were any prerelease versions of 0.2.0 in the changelog, it will also collect their changes into the final 0.2.0 entry
- make a commit bumping the version:
Bump version to 0.2.0
and adds the new changelog section to the commit's body - publish the package to NuGet
- push a git tag
- create a GitHub release for that git tag
- update
macOS/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 | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- FSharp.Core (>= 7.0.0)
NuGet packages (4)
Showing the top 4 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. |
|
Navs
Package Description |
|
Hox
Package Description |
|
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. |
GitHub repositories (1)
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.7 | 12,979 | 7/11/2024 |
0.11.6 | 798 | 5/8/2024 |
0.11.5 | 3,031 | 4/22/2024 |
0.11.4 | 3,675 | 4/6/2024 |
0.11.3 | 534 | 2/7/2024 |
0.11.2 | 117 | 2/7/2024 |
0.11.0 | 577 | 1/31/2024 |
0.10.2 | 346 | 1/29/2024 |
0.10.0 | 18,104 | 11/22/2023 |
0.9.2 | 7,529 | 11/9/2023 |
0.9.1 | 130 | 11/8/2023 |
0.9.0 | 162 | 11/6/2023 |
0.8.5 | 757 | 10/29/2023 |
0.8.5-beta001 | 126 | 10/28/2023 |
0.8.4 | 148 | 10/28/2023 |
0.8.3 | 146 | 10/27/2023 |
0.8.2 | 376 | 10/23/2023 |
0.8.2-beta003 | 115 | 10/23/2023 |
0.8.0 | 2,372 | 7/18/2023 |
0.7.1 | 206 | 7/8/2023 |
0.7.0 | 12,274 | 7/4/2023 |
0.6.0 | 210 | 6/30/2023 |
0.6.0-beta001 | 149 | 6/30/2023 |
0.5.4 | 5,589 | 4/3/2023 |
0.5.4-beta004 | 139 | 4/3/2023 |
0.5.3 | 11,079 | 2/22/2023 |
0.5.1 | 3,153 | 12/17/2022 |
0.5.0 | 578 | 12/9/2022 |
0.5.0-beta001 | 143 | 12/9/2022 |
0.4.0 | 390 | 12/2/2022 |
0.3.2 | 344 | 12/1/2022 |
0.3.2-beta002 | 151 | 12/1/2022 |
0.3.2-beta001 | 133 | 12/1/2022 |
0.3.1 | 363 | 11/27/2022 |
0.3.1-beta002 | 139 | 11/27/2022 |
0.3.1-beta001 | 149 | 11/27/2022 |
0.3.0 | 1,379 | 11/8/2022 |
0.3.0-beta007 | 158 | 11/8/2022 |
0.3.0-beta006 | 156 | 11/8/2022 |
0.3.0-beta005 | 105 | 11/8/2022 |
0.3.0-beta004 | 111 | 11/8/2022 |
0.3.0-beta001 | 105 | 11/7/2022 |
0.2.0 | 38,313 | 3/23/2022 |
0.1.1 | 455 | 3/7/2022 |
0.1.0 | 560 | 3/6/2022 |
0.1.0-beta004 | 168 | 3/6/2022 |
0.1.0-beta003 | 184 | 3/6/2022 |
0.1.0-beta002 | 174 | 3/6/2022 |
0.1.0-beta001 | 170 | 3/6/2022 |
## [0.3.1-beta001] - 2022-11-27
[0.3.1-beta001]: https://github.com/TheAngryByrd/IcedTasks/compare/v0.3.0...v0.3.1-beta001
### Changed
- [Test refactoring and docs](https://github.com/TheAngryByrd/IcedTasks/pull/11). Credits @TheAngryByrd