Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
a9b4c77
tidy(Async.parallelMap*): Remove unnecessary ifdef
bartelink Sep 11, 2026
5ce16a5
feat(net10): Add TFM-specific build, omitting duplicates present in F…
bartelink Sep 14, 2026
421de83
feat(Task): FSharp.Core 11 shims for < net10 builds
bartelink Sep 12, 2026
81704c6
refactor(Task): rename/Obsolete singleton -> result
bartelink Sep 12, 2026
ede6bee
feat(Task)!: Implement breaking changes re FSharp.Core 11
bartelink Sep 12, 2026
6a01013
feat(Async): FSharp.Core V11 shims
bartelink Sep 12, 2026
43353a2
refactor(Async.singleton)!: Obsolete singleton in favor of result
bartelink Sep 12, 2026
0f35207
refactor(singleton): Replace with result/ok/some
bartelink Sep 13, 2026
85e0d91
refactor(TaskResult)!: Align with Task names
bartelink Sep 12, 2026
a6e4138
refactor(catch, ofCatchTash): Replace with catchWith/catch
bartelink Sep 13, 2026
64980c0
feat: ValueTask shims
bartelink Oct 12, 2026
0deb3e5
chore: Shim and replace Async.AwaitTask -> Await
bartelink Sep 17, 2026
ebc49da
tidy(Async): Apply StartTaskImmediate/StartImmediateAsTask consistently
bartelink Oct 13, 2026
0e66b9a
feat(Result): Conditionally remove dups for net6
bartelink Sep 11, 2026
d232322
feat(net10): Exclude builtins
bartelink Oct 13, 2026
5932c2e
doc(JobOption.eitherBind): Fix signature/example
bartelink Oct 13, 2026
6704d2a
Changelog
bartelink Oct 13, 2026
e89ad97
feat(net10): Exclude dups of intrinsics
bartelink Oct 13, 2026
e932c92
review
bartelink Oct 13, 2026
078402d
feat: ofTaskUnit
bartelink Oct 14, 2026
8f2d51e
fix(ofAsync/ofTask/ofResult): Obsolete inconsistent semantics
bartelink Oct 14, 2026
8ab4408
review
bartelink Oct 14, 2026
241cc10
chore(Task): Sync parallelLimit etc from upstream
bartelink Oct 14, 2026
52a9e5d
review
bartelink Oct 14, 2026
7750ca1
review: Address slips, nits, inconsistencies and doc/comment inaccura…
bartelink Oct 26, 2026
10845cb
fix(Await): Correct SyncContext honoring
bartelink Oct 26, 2026
9289435
review(TaskResult): Restore full semantics to Obsolete catch/ofCatchT…
bartelink Oct 26, 2026
0e6f542
review(Async): Remove erroneous dups to align with Task
bartelink Oct 26, 2026
7b7e297
review(Async): Adjust conditional compilation to surface shims to Fable
bartelink Oct 26, 2026
698a751
review(Shims): Include forwarders in >= net10
bartelink Oct 26, 2026
af1b7d0
review: Self-review pass
bartelink Oct 26, 2026
b627860
review: Correct absence of Async forwarders
bartelink Oct 31, 2026
16aa9d3
review: Correct Obsoletion semantics
bartelink Oct 31, 2026
37ce7a7
review: doc/lint
bartelink Oct 31, 2026
fbccbe4
review: More cleanups
bartelink Nov 7, 2026
0386a62
refactor(Result,Option): Move shims to separate files
bartelink Nov 7, 2026
19cdfac
fix(Agent): Warn about not using build for Format check
bartelink Nov 7, 2026
0d66c9e
test(Shims): Happy path tests validating shimming
bartelink Nov 7, 2026
afd0584
refactor(Option): Remove superfluous shims
bartelink Nov 7, 2026
456ae11
build: Move to SDK 11 and test on net10.0 and net11.0
TheAngryByrd Nov 13, 2026
20e84c8
build(deps): Update FAKE to 6.2.0 to remove vulnerable build packages
TheAngryByrd Nov 13, 2026
671e116
feat: Add net11.0 and forward to FSharp.Core 11 only on net11.0
TheAngryByrd Nov 13, 2026
03ac23e
build: Update Fable to 5.27.0 for SDK 11
TheAngryByrd Nov 13, 2026
357a1e8
build: Install the matching fable-library before the Python tests
TheAngryByrd Nov 13, 2026
23a8f05
test: Make Async.never cancellable and fail an unfinished JS run
TheAngryByrd Nov 13, 2026
3f74682
test: Add behavior tests for the FSharp.Core 11 shims
TheAngryByrd Nov 13, 2026
5e800d6
fix(Async): Limit parallelLimit concurrency on Fable Python
TheAngryByrd Nov 13, 2026
a123ce0
test(Task): Pin sequential cancellation and track the FSharp.Core gap…
TheAngryByrd Nov 13, 2026
ac68a1e
fix(ParallelAsyncResult): Avoid a generic exception type test under F…
TheAngryByrd Nov 13, 2026
df08666
build(devcontainer): Use SDK 11 with runtime 10 and Python 3.13
TheAngryByrd Nov 13, 2026
dcb7ec0
Merge remote-tracking branch 'origin/master' into pr-373-diagnose
TheAngryByrd Nov 13, 2026
a9ee82e
test: Use Async.result in the #380 taskValidation test
TheAngryByrd Nov 13, 2026
600210c
docs: correct shim examples, obsolete messages, and doc claims
TheAngryByrd Nov 13, 2026
9c16cc7
docs: Async and Task removals are binary breaks on all TFMs
TheAngryByrd Nov 13, 2026
c7a18cd
Merge origin/master (6.0.0-beta004, #385) into fscore11-shims
TheAngryByrd Nov 17, 2026
f4e16c2
docs: complete the JobResult.catchWith cancellation note
TheAngryByrd Nov 17, 2026
2761d7f
feat(Task): ofValueTask on netstandard2.0
TheAngryByrd Nov 17, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"fable": {
"version": "4.28.0",
"version": "5.27.0",
"commands": [
"fable"
],
Expand Down
6 changes: 3 additions & 3 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
"ghcr.io/devcontainers-contrib/features/starship:1": {},
// https://github.com/devcontainers/features/blob/main/src/dotnet/README.md
"ghcr.io/devcontainers/features/dotnet:2": {
"version": "10.0",
"additionalVersions": "8.0,9.0"
"version": "11.0",
"additionalVersions": "10.0"
},
"ghcr.io/devcontainers/features/node:1": {
"version": "22"
},
"ghcr.io/devcontainers/features/python:1": {
"version": "3.10"
"version": "3.13"
}
},
"overrideFeatureInstallOrder": [
Expand Down
3 changes: 2 additions & 1 deletion .fantomasignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
AssemblyInfo.fs
tests/FsToolkit.ErrorHandling.AsyncSeq.Tests/Main.fs
tests/FsToolkit.ErrorHandling.Tests/Main.fs
src/FsToolkit.ErrorHandling/Async.FSharpCore11.fs
tests/FsToolkit.ErrorHandling.Tests/Main.fs
11 changes: 11 additions & 0 deletions .github/actions/setup-dotnet/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Setup .NET
description: Install the SDK from global.json and the runtimes that the test projects target.
runs:
using: composite
steps:
- uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
dotnet-version: |
10.x
11.x
34 changes: 5 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,7 @@ jobs:
steps:
- uses: actions/checkout@v7
- name: Setup necessary dotnet SDKs
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
dotnet-version: |
8.x
9.x
10.x
uses: ./.github/actions/setup-dotnet

- name: Build via Bash
if: runner.os != 'Windows'
Expand Down Expand Up @@ -71,13 +65,7 @@ jobs:
node-version: ${{ matrix.node-version }}

- name: Setup necessary dotnet SDKs
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
dotnet-version: |
8.x
9.x
10.x
uses: ./.github/actions/setup-dotnet

- name: Build via Bash
if: runner.os != 'Windows'
Expand All @@ -99,7 +87,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version: ['3.10', '3.11', '3.12']
python-version: ['3.12', '3.13']
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -111,13 +99,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Setup necessary dotnet SDKs
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
dotnet-version: |
8.x
9.x
10.x
uses: ./.github/actions/setup-dotnet
- name: Build via Bash
if: runner.os != 'Windows'
run: |
Expand Down Expand Up @@ -153,13 +135,7 @@ jobs:
steps:
- uses: actions/checkout@v7
- name: Setup necessary dotnet SDKs
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
dotnet-version: |
8.x
9.x
10.x
uses: ./.github/actions/setup-dotnet
- name: Analyze
run: |
chmod +x ./build.sh
Expand Down
8 changes: 1 addition & 7 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,7 @@ jobs:
persist-credentials: false

- name: Setup necessary dotnet SDKs
uses: actions/setup-dotnet@v6
with:
global-json-file: global.json
dotnet-version: |
8.x
9.x
10.x
uses: ./.github/actions/setup-dotnet

- name: Build, test and pack
run: |
Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@
- Be Brief.
- Do not `> nul` or `> NUL` (or any casing variation) on Windows machines to pipe output. This create a file that cannot be deleted and breaks other tooling.
- Do not delete code comments unless that the code is being deleted or the comment is factually incorrect. If you think a comment is wrong, update it to be correct rather than deleting it.
- `./build.sh CheckFormatCode` runs `Clean` first, deleting build and generated test outputs. Do not run it concurrently with builds or tests; use `dotnet fantomas --check .` for a non-cleaning format check.
- If you ever encounter something in the project that surprises you, please alert the developer working with you and indicate that this is the case, and ask to add a note to the AGENTS.md file to prevent future agents from having the same issue.
8 changes: 4 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<NoWarn>$(NoWarn);FS2003;NU1903;NU1904;FS0057</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<WarningsAsErrors />
<!--
<!--
Changing the LangVersion based on TFM because F# 9 brings in new features that older SDK's can't support.
See https://github.com/dotnet/fsharp/issues/14313 for an example.
To keep this library as backward compatible as possible we're setting the LangVersion to 8.0 by default.
Then, we're assuming if you're building for net9.0 you're using F# 9 Language features.
Then, we're assuming if you're building for net9.0 or later, you're using F# 9 Language features.
-->
<LangVersion>8.0</LangVersion>
<LangVersion Condition="'$(TargetFramework)' == 'net9.0'">9.0</LangVersion>
<Nullable Condition="'$(TargetFramework)' == 'net9.0'">enable</Nullable>
<LangVersion Condition=" $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','net9.0')) ">9.0</LangVersion>
<Nullable Condition=" $([MSBuild]::IsTargetFrameworkCompatible('$(TargetFramework)','net9.0')) And '$(FABLE_COMPILER)' != 'true' ">enable</Nullable>
</PropertyGroup>


Expand Down
20 changes: 10 additions & 10 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@
<PackageVersion Include="BenchmarkDotNet.Diagnostics.Windows" Version="0.15.0" />

<!-- Build group dependencies -->
<PackageVersion Include="Fake.Core.Target" Version="5.22.0" />
<PackageVersion Include="Fake.DotNet.Cli" Version="5.22.0" />
<PackageVersion Include="Fake.Core.ReleaseNotes" Version="5.22.0" />
<PackageVersion Include="Fake.DotNet.AssemblyInfoFile" Version="5.22.0" />
<PackageVersion Include="Fake.DotNet.Testing.Expecto" Version="5.22.0" />
<PackageVersion Include="Fake.Tools.Git" Version="5.22.0" />
<PackageVersion Include="Fake.JavaScript.Npm" Version="5.22.0" />
<PackageVersion Include="Fake.Api.GitHub" Version="5.22.0" />
<PackageVersion Include="Fake.BuildServer.GitHubActions" Version="5.22.0" />
<PackageVersion Include="Fake.Core.Target" Version="6.2.0" />
<PackageVersion Include="Fake.DotNet.Cli" Version="6.2.0" />
<PackageVersion Include="Fake.Core.ReleaseNotes" Version="6.2.0" />
<PackageVersion Include="Fake.DotNet.AssemblyInfoFile" Version="6.2.0" />
<PackageVersion Include="Fake.DotNet.Testing.Expecto" Version="6.2.0" />
<PackageVersion Include="Fake.Tools.Git" Version="6.2.0" />
<PackageVersion Include="Fake.JavaScript.Npm" Version="6.2.0" />
<PackageVersion Include="Fake.Api.GitHub" Version="6.2.0" />
<PackageVersion Include="Fake.BuildServer.GitHubActions" Version="6.2.0" />
<PackageVersion Include="MSBuild.StructuredLogger" Version="2.2.206" />
<PackageVersion Include="Octokit" Version="0.53.0" />
<PackageVersion Include="Nuget.Common" Version="6.6.1" />
<PackageVersion Include="NuGet.Protocol" Version="6.6.1" />
<PackageVersion Include="NuGet.Protocol" Version="6.12.5" />
<PackageVersion Include="System.Security.Cryptography.Pkcs" Version="7.0.2" />

<!-- Analyzers group dependencies -->
Expand Down
84 changes: 82 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,83 @@
### 6.0.0-beta005 - tba

- [`Async.Await`, `Async.StartTaskImmediate`, `Task.startAsyncImmediate`, `Async`+`Task`+`ValueTask` shims and related obsoletions](https://github.com/demystifyfp/FsToolkit.ErrorHandling/pull/373) Credits @bartelink
- feat(Async, Task, ValueTask): `result`. Replaces `singleton`; aligned with FSharp.Core >= 11 naming.
- BREAKING(Task)!: `catch` returns `Task<Result<_,_>>` (was `Task<Choice<_,_>>`) to match FSharp.Core >= 11.
- NOTE BEHAVIOR CHANGE(Task): `map` on an already completed task runs the mapper at once. If the mapper throws `OperationCanceledException`, the result is now `Faulted` (was `Canceled`), as in FSharp.Core >= 11. A task that is still running gives `Canceled` as before.
- BREAKING(Async, Task, Option)!: Add `RequiresExplicitTypeArguments` to `ignore` align with FSharp.Core Task/Async naming.
- feat: `net11.0` target, which forwards the `Async` and `Task` shims to FSharp.Core 11. FSharp.Core minimum: `netstandard2.0`, `netstandard2.1`, `net6.0` 6.0.4, `net9.0` 9.0.300, `net10.0` 10.0.100, `net11.0` 11.0.101.
- (net10 and lower TFMs) feat(Async, Task, ValueTask): Shims of `Async.Await`, `Async.StartTaskImmediate`, `Task.startAsyncImmediate` and related functions to align with FSharp.Core >= 11.0.0.
- The `ValueTask` overloads, the `ValueTask` module, and `Task.ofValueTask` are also on `netstandard2.0`, through `Microsoft.Bcl.AsyncInterfaces`. FSharp.Core 11 has them only on `netstandard2.1` and later.
- NOTE KNOWN DIFFERENCE(Task): with an already canceled token, `sequential` and `sequentialDo` give `Canceled` and call no factory. On net11, FSharp.Core 11.0.101 calls the factories, because it does not contain dotnet/fsharp#20695. [#384](https://github.com/demystifyfp/FsToolkit.ErrorHandling/issues/384) tracks the FSharp.Core release with the fix.
- (all TFMs) remove(`Async`): functions shadowing FSharp.Core equivalents: `map`, `bind`, `ignore`
- Moved to `FsToolkit.ErrorHandling.FSharpCore11AsyncShims.Async`, which is AutoOpen below net11 and on Fable. On net11, FSharp.Core supplies them.
- (all TFMs) remove(`Task`): functions shadowing FSharp.Core equivalents: `map`, `bind`, `ignore`, `catch`
- Moved to `FsToolkit.ErrorHandling.FSharpCore11TaskShims.Task`, which is AutoOpen below net11. On net11, FSharp.Core supplies them.
- (all TFMs) remove(`Result`): functions shadowing FSharp.Core equivalents: `map`, `mapError`, `bind`, `isOk`, `isError`, `defaultWith`, `defaultValue`
- Moved to `FsToolkit.ErrorHandling.FSharpCore11ResultShims.Result`, which is AutoOpen below net9 and on Fable. On net9 and later, FSharp.Core supplies them.
- These moves keep source compatibility through `open FsToolkit.ErrorHandling`. They are binary breaks on all TFMs.
- [`Async.Await` and `catch`/`catchWith` consistency](https://github.com/demystifyfp/FsToolkit.ErrorHandling/pull/373) Credits @bartelink
- feat(AsyncResult, JobResult, TaskResult): `catchWith`.
- Same signature as `catch` but aligning with FSharp.Core naming and semantics.
- NOTE KEY BEHAVIOR: `Task.catchWith` does NOT trap `OperationCanceledException`/`TaskCanceledException` (the outgoing `catch` and `Task.ofCatchTask` functions did, the incoming `Task.catch` and `Task.catchWith` functions do not).
- NOTE In contrast, `JobResult.catchWith` _can_ yield `Error TaskCanceledException`/`OperationCanceledException` if the underlying computation is canceled. This is consistent with the `Job.catch` semantics.
- NOTE In contrast, `Async.catchWith` **at present** _can_ yield `Error TaskCanceledException`/`OperationCanceledException` if the underlying computation is canceled, but this is consistent with the incoming `Async.catch`/`Async.catchWith` semantics as they presently stand.
- BREAKING(AsyncOption, AsyncResult, AsyncResultOption, AsyncValidation, CancellableTaskResult, CancellableTaskValidation, CancellableValueTaskOption, ParallelAsyncResult, ParallelAsyncValidation)!:
- Internal usage of `AwaitTask` switches to `Await`
- NOTE BEHAVIOR CHANGE: exceptions surfaced in calling code are no longer egregiously wrapped in `AggregateException`, i.e. you can now `try ... with` targeting the actual exception type to handle exceptions from the awaited Task. [#154](https://github.com/demystifyfp/FsToolkit.ErrorHandling/issues/154).
- Renames:
- OBSOLETE(Async, Task, Job): `singleton`
Comment thread
bartelink marked this conversation as resolved.
Resolved
- -> `result`.
- OBSOLETE(CancellableTaskResult, CancellableTaskValidation, CancellableValueTaskResult): `singleton`
- -> `ok`.
- Removals:
- remove(`Option`)!: functions shadowing FSharp.Core equivalents: `map`, `map2`, `map3`, `bind`
- Present in all supported FSharp.Core versions and Fable, so no reason for them to be in the library.
- OBSOLETE(AsyncResult): `ofAsync`
- -> `Async.map Ok`
- -> CONSIDER `Async.catch`
- NOTE semantics did not match those of `TaskResult.ofAsync`
- OBSOLETE(JobResult): `ofAsync`
- -> `JobResult.fromAsync`
- -> CONSIDER `Job.map Ok`
- NOTE semantics did not match those of `AsyncResult.ofAsync`
- OBSOLETE(TaskResult): `ofAsync`
- -> `Task.startAsyncImmediate ct >> Task.catch`
- OR (if no `CancellationToken` available) -> `Async.StartImmediateAsTask >> Task.catch`
- NOTE semantics did not match those of `AsyncResult.ofAsync`
- NOTE semantics did not cover flowing cancellation
- OBSOLETE(AsyncResult): `ofTask`
- -> `Async.Await >> Async.catch`.
- NOTE semantics did not match those of `TaskResult.ofTask`
- OBSOLETE(TaskResult): `ofTask`
- -> `Task.map Ok`
- -> CONSIDER `Task.catch`
- NOTE semantics did not match those of `AsyncResult.ofTask`
- OBSOLETE(Async): `AwaitCancellableTaskOption`, `AwaitCancellableTaskResult`, `AwaitCancellableTaskValidation`, `AwaitCancellableValueTaskOption`
- -> `Async.StartTaskImmediate` has overloads supporting `Task` and `ValueTask`, and flows cancellation correctly.
- OBSOLETE(AsyncEx): `AwaitCancellableTaskOption`, `AwaitCancellableTaskResult`, `AwaitCancellableValueTaskOption`
- -> `Async.StartTaskImmediate` has overloads supporting `Task` and `ValueTask`, and flows cancellation correctly.
- OBSOLETE(AsyncResult): `ofTaskAction`
- -> `Async.Await >> Async.catch`.
- NOTE did not exist on `TaskResult` or `JobResult`.
- OBSOLETE(AsyncResult, JobResult, TaskResult): `XResult.ofResult`
- -> `X.result`.
- OBSOLETE(AsyncResult, JobResult, TaskResult): `catch`
- -> `catchWith`.
- NOTE BEHAVIOR CHANGE: `Task.catchWith` does NOT trap `OperationCanceledException`/`TaskCanceledException` (the outgoing function did, but this is inconsistent with the FSharp.Core 11 `Task.catch`/`catchWith` semantics).
- OBSOLETE(TaskResult): `ofCatchTask`
- -> `Task.catch`.
- NOTE BEHAVIOR CHANGE: `Task.catch` does NOT trap `OperationCanceledException`/`TaskCanceledException` (the outgoing function did, but this is inconsistent with the FSharp.Core 11 `Task.catch`/`catchWith` semantics).
- [Stragglers from beta003](https://github.com/demystifyfp/FsToolkit.ErrorHandling/pull/373) Credits @bartelink
- feat(CancellableTask, CancellableValueTask): `result`
- feat(CancellableTaskResult, CancellableTaskValidation): `ok`
- feat(CancellableTaskResult): `error`
- feat(JobOption): `none`
- feat(CancellableTaskValidation, Validation): `errors`
- Renames:
- OBSOLETE(JobOption): `singleton`
- -> `some`.

### 6.0.0-beta004 - November 17, 2026

- [Observe DisposeAsync faults and cancellations in task computation expressions](https://github.com/demystifyfp/FsToolkit.ErrorHandling/pull/385) Credits @TheAngryByrd
Expand Down Expand Up @@ -108,10 +188,10 @@ FsToolkit.ErrorHandling.IcedTasks as a dependency.
### 4.17.0 - September 23, 2024
- [Adding Seq.traverse & sequence functions](https://github.com/demystifyfp/FsToolkit.ErrorHandling/pull/277) Credits @1eyewonder

### [4.16.0] - July 15, 2024
### 4.16.0 - July 15, 2024
- [Add Task.ignore](https://github.com/demystifyfp/FsToolkit.ErrorHandling/pull/272) Credits @odytrice

### [4.15.3] - July 13, 2024
### 4.15.3 - July 13, 2024
- [Added XML Comments](https://github.com/demystifyfp/FsToolkit.ErrorHandling/pull/268) Credits @1eyewonder
- [Fix Using/TryFinally asyncValidation CE](https://github.com/demystifyfp/FsToolkit.ErrorHandling/pull/271) Credits @1eyewonder

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/AsyncResultCE.fs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ module AsyncResultCEExtensions =
/// <summary>
/// Method lets us transform data types into our internal representation.
/// </summary>
member inline _.Source(result: Result<_, _>) : Async<Result<_, _>> = Async.singleton result
member inline _.Source(result: Result<_, _>) : Async<Result<_, _>> = Async.result result

let rec fib n =
if n < 2L then
Expand Down
16 changes: 8 additions & 8 deletions benchmarks/Benchmarks.fs
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ module ArrayOriginal =
}

match r with
| Ok _ -> return! traverseAsyncResultM' (Async.singleton r) f xs
| Ok _ -> return! traverseAsyncResultM' (Async.result r) f xs
| Error _ -> return r
}

Expand Down Expand Up @@ -822,7 +822,7 @@ module ArrayOriginal =
}

match o with
| Some _ -> return! traverseAsyncOptionM' (Async.singleton o) f xs
| Some _ -> return! traverseAsyncOptionM' (Async.result o) f xs
| None -> return o
}

Expand Down Expand Up @@ -1181,10 +1181,10 @@ module JobOptionOriginal =
return! t
}

let inline singleton x = job { return Some x }
let inline some x = job { return Some x }

let inline apply f x =
bind (fun f' -> bind (fun x' -> singleton (f' x')) x) f
bind (fun f' -> bind (fun x' -> some (f' x')) x) f

[<MemoryDiagnoser>]
type JobOptionApplyBenchmarks() =
Expand Down Expand Up @@ -1224,13 +1224,13 @@ type JobOptionApplyBenchmarks() =
|> Hopac.run

[<Benchmark>]
member _.JobOption_Original_Singleton() =
JobOptionOriginal.singleton 1
member _.JobOption_Original_Some() =
JobOptionOriginal.some 1
|> Hopac.run

[<Benchmark>]
member _.JobOption_Current_Singleton() =
FsToolkit.ErrorHandling.JobOption.singleton 1
member _.JobOption_Current_Some() =
FsToolkit.ErrorHandling.JobOption.some 1
|> Hopac.run

[<Benchmark>]
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/benchmarks.fsproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TargetFrameworks>net10.0;net11.0</TargetFrameworks>
<OutputType>Exe</OutputType>
</PropertyGroup>
<PropertyGroup>
Expand Down
Loading
Loading