Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 @@ -10,7 +10,7 @@
"rollForward": false
},
"fantomas": {
"version": "7.0.1",
"version": "7.0.3",
"commands": [
"fantomas"
],
Expand Down
7 changes: 5 additions & 2 deletions src/IcedTasks/AsyncEx.fs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
namespace IcedTasks
namespace IcedTasks.AsyncEx

open System
open System.Threading
open System.Threading.Tasks
open System.Runtime.ExceptionServices
open System.Collections.Generic
open IcedTasks.Nullness
open IcedTasks.TaskLike

type private Async =
type internal Async =
static member inline map f x =
async.Bind(x, (fun v -> async.Return(f v)))

Expand Down Expand Up @@ -343,6 +345,7 @@ namespace IcedTasks.Polyfill.Async
[<AutoOpen>]
module PolyfillBuilders =
open IcedTasks
open IcedTasks.AsyncEx

/// <summary>
/// Builds an asynchronous workflow using computation expression syntax.
Expand Down
21 changes: 21 additions & 0 deletions src/IcedTasks/AutoOpens.fs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
namespace IcedTasks

/// Module exists to AutoOpen all relevant IcedTasks modules for ease of use when opening the main IcedTasks namespace.
[<AutoOpen>]
module AutoOpens =

[<assembly: AutoOpen("IcedTasks")>]
[<assembly: AutoOpen("IcedTasks.TaskLike")>]
[<assembly: AutoOpen("IcedTasks.TasksUnit")>]
[<assembly: AutoOpen("IcedTasks.AsyncEx")>]
[<assembly: AutoOpen("IcedTasks.ParallelAsync")>]
[<assembly: AutoOpen("IcedTasks.TaskBase")>]
[<assembly: AutoOpen("IcedTasks.ValueTasks")>]
[<assembly: AutoOpen("IcedTasks.PoolingValueTasks")>]
[<assembly: AutoOpen("IcedTasks.ValueTasksUnit")>]
[<assembly: AutoOpen("IcedTasks.ColdTasks")>]
[<assembly: AutoOpen("IcedTasks.CancellableTaskBase")>]
[<assembly: AutoOpen("IcedTasks.CancellableValueTasks")>]
[<assembly: AutoOpen("IcedTasks.CancellablePoolingValueTasks")>]
[<assembly: AutoOpen("IcedTasks.CancellableTasks")>]
do ()
12 changes: 11 additions & 1 deletion src/IcedTasks/CancellablePoolingValueTask.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@
// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights
// to this software to the public domain worldwide. This software is distributed without any warranty.

namespace IcedTasks
namespace IcedTasks.CancellablePoolingValueTasks

#if NET6_0_OR_GREATER

open IcedTasks
open IcedTasks.TaskLike
open IcedTasks.CancellableTaskBase
open IcedTasks.ValueTasks

/// Contains methods to build CancellableTasks using the F# computation expression syntax
[<AutoOpen>]
module CancellablePoolingValueTasks =
Expand Down Expand Up @@ -261,6 +267,8 @@ module CancellablePoolingValueTasks =
[<AutoOpen>]
module HighPriority =

open IcedTasks.AsyncEx

type AsyncEx with

/// <summary>Return an asynchronous computation that will wait for the given task to complete and return
Expand Down Expand Up @@ -330,6 +338,8 @@ module CancellablePoolingValueTasks =
/// </summary>
[<AutoOpen>]
module AsyncExtensions =
open IcedTasks.AsyncEx

type AsyncExBuilder with

member inline this.Source([<InlineIfLambda>] t: CancellableValueTask<'T>) : Async<'T> =
Expand Down
6 changes: 5 additions & 1 deletion src/IcedTasks/CancellableTask.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights
// to this software to the public domain worldwide. This software is distributed without any warranty.

namespace IcedTasks
namespace IcedTasks.CancellableTasks

open IcedTasks.TaskLike
open IcedTasks.CancellableTaskBase

/// Contains methods to build CancellableTasks using the F# computation expression syntax
[<AutoOpen>]
Expand All @@ -25,6 +27,7 @@ module CancellableTasks =
open Microsoft.FSharp.Core.CompilerServices.StateMachineHelpers
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
open Microsoft.FSharp.Collections
open IcedTasks

/// CancellationToken -> Task<'T>
type CancellableTask<'T> = CancellationToken -> Task<'T>
Expand Down Expand Up @@ -333,6 +336,7 @@ module CancellableTasks =
/// </summary>
[<AutoOpen>]
module AsyncExtensions =
open IcedTasks.AsyncEx

type AsyncExBuilder with

Expand Down
8 changes: 7 additions & 1 deletion src/IcedTasks/CancellableTaskBuilderBase.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
namespace IcedTasks
namespace IcedTasks.CancellableTaskBase

open IcedTasks
open IcedTasks.Nullness
open IcedTasks.TaskLike

/// Contains methods to build Tasks using the F# computation expression syntax
[<AutoOpen>]
Expand All @@ -14,6 +18,7 @@ module CancellableTaskBase =
open Microsoft.FSharp.Collections
open System.Collections.Generic


/// The extra data stored in ResumableStateMachine for tasks
[<Struct; NoComparison; NoEquality>]
type CancellableTaskBaseStateMachineData<'T, 'Builder> =
Expand Down Expand Up @@ -605,6 +610,7 @@ module CancellableTaskBase =
/// <exclude/>
[<AutoOpen>]
module HighPriority =
open IcedTasks.AsyncEx


type AsyncEx with
Expand Down
9 changes: 8 additions & 1 deletion src/IcedTasks/CancellableValueTask.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@
// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights
// to this software to the public domain worldwide. This software is distributed without any warranty.

namespace IcedTasks
namespace IcedTasks.CancellableValueTasks

open IcedTasks
open IcedTasks.ValueTasks
open IcedTasks.TaskLike
open IcedTasks.CancellableTaskBase

/// Contains methods to build CancellableTasks using the F# computation expression syntax
[<AutoOpen>]
Expand Down Expand Up @@ -243,6 +247,7 @@ module CancellableValueTasks =
/// <exclude />
[<AutoOpen>]
module HighPriority =
open IcedTasks.AsyncEx

type AsyncEx with

Expand Down Expand Up @@ -313,6 +318,8 @@ module CancellableValueTasks =
/// </summary>
[<AutoOpen>]
module AsyncExtensions =
open IcedTasks.AsyncEx

type AsyncExBuilder with

member inline this.Source([<InlineIfLambda>] t: CancellableValueTask<'T>) : Async<'T> =
Expand Down
12 changes: 9 additions & 3 deletions src/IcedTasks/ColdTask.fs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,12 @@
// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights
// to this software to the public domain worldwide. This software is distributed without any warranty.

namespace IcedTasks
namespace IcedTasks.ColdTasks

open IcedTasks
open IcedTasks.Nullness
open IcedTasks.TaskLike


/// Contains methods to build ColdTasks using the F# computation expression syntax
[<AutoOpen>]
Expand Down Expand Up @@ -633,6 +638,7 @@ module ColdTasks =
/// <exclude />
[<AutoOpen>]
module HighPriority =
open IcedTasks.AsyncEx
// High priority extensions

type AsyncEx with
Expand Down Expand Up @@ -719,7 +725,7 @@ module ColdTasks =
/// </summary>
[<AutoOpen>]
module AsyncExtensions =

open IcedTasks.AsyncEx

type AsyncExBuilder with

Expand Down Expand Up @@ -753,7 +759,7 @@ module ColdTasks =

member inline this.ReturnFrom(coldTask: ColdTask) = this.ReturnFrom(coldTask ())

type TaskBuilderBase with
type IcedTasks.TaskBase.TaskBase.TaskBuilderBase with

member inline this.Source(coldTask: ColdTask<'T>) = (coldTask ()).GetAwaiter()

Expand Down
1 change: 1 addition & 0 deletions src/IcedTasks/IcedTasks.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<Compile Include="CancellableValueTask.fs" />
<Compile Include="CancellablePoolingValueTask.fs" />
<Compile Include="CancellableTask.fs" />
<Compile Include="AutoOpens.fs" />
</ItemGroup>

<ItemGroup>
Expand Down
5 changes: 4 additions & 1 deletion src/IcedTasks/Nullness.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
namespace IcedTasks
namespace IcedTasks.Nullness

// This file exists to define nullable and non-nullable types for compatibility with older FSharp.Core libraries.
// Nullable/Nullness only works for FSharp.Core 9+. For older versions, we define types without nullability annotations and assume reference types can be null.

open System

Expand Down
3 changes: 2 additions & 1 deletion src/IcedTasks/ParallelAsync.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace IcedTasks
namespace IcedTasks.ParallelAsync

open System
open System.Threading
open IcedTasks.AsyncEx

/// Contains different implementations for parallel zip functions.
type ParallelAsync =
Expand Down
6 changes: 5 additions & 1 deletion src/IcedTasks/PoolingValueTask.fs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
namespace IcedTasks

namespace IcedTasks.PoolingValueTasks

#if NET6_0_OR_GREATER

open IcedTasks
open IcedTasks.TaskLike
open IcedTasks.TaskBase
// Task builder for F# that compiles to allocation-free paths for synchronous code.
//
// Originally written in 2016 by Robert Peele ([email protected])
Expand All @@ -13,7 +18,6 @@ namespace IcedTasks
// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights
// to this software to the public domain worldwide. This software is distributed without any warranty.

namespace IcedTasks

/// Contains methods to build PoolingValueTasks using the F# computation expression syntax
[<AutoOpen>]
Expand Down
2 changes: 2 additions & 0 deletions src/IcedTasks/Task.fs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module Tasks =
open Microsoft.FSharp.Core.CompilerServices.StateMachineHelpers
open Microsoft.FSharp.Core.LanguagePrimitives.IntrinsicOperators
open IcedTasks
open IcedTasks.TaskLike
open IcedTasks.TaskBase

///<summary>
/// Contains methods to build Tasks using the F# computation expression syntax
Expand Down
5 changes: 4 additions & 1 deletion src/IcedTasks/TaskBuilderBase.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
namespace IcedTasks
namespace IcedTasks.TaskBase

open IcedTasks.Nullness
open IcedTasks.TaskLike

/// Contains methods to build Tasks using the F# computation expression syntax
[<AutoOpen>]
Expand Down
2 changes: 1 addition & 1 deletion src/IcedTasks/TaskLike.fs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace IcedTasks
namespace IcedTasks.TaskLike

open System.Runtime.CompilerServices
open Microsoft.FSharp.Core.CompilerServices
Expand Down
6 changes: 5 additions & 1 deletion src/IcedTasks/TaskUnit.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ namespace IcedTasks
// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights
// to this software to the public domain worldwide. This software is distributed without any warranty.

namespace IcedTasks
namespace IcedTasks.TasksUnit

open IcedTasks
open IcedTasks.TaskLike
open IcedTasks.TaskBase

/// Contains methods to build Tasks using the F# computation expression syntax
[<AutoOpen>]
Expand Down
10 changes: 7 additions & 3 deletions src/IcedTasks/ValueTask.fs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace IcedTasks
namespace IcedTasks.ValueTasks


open System.Threading.Tasks

open IcedTasks.TaskLike

/// <summary>
/// Module with extension methods for <see cref="T:System.Threading.Tasks.ValueTask`1"/>.
Expand Down Expand Up @@ -75,7 +75,11 @@ module ValueTaskExtensions =
// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights
// to this software to the public domain worldwide. This software is distributed without any warranty.

namespace IcedTasks
namespace IcedTasks.ValueTasks

open IcedTasks
open IcedTasks.TaskLike
open IcedTasks.TaskBase

/// Contains methods to build ValueTasks using the F# computation expression syntax
[<AutoOpen>]
Expand Down
6 changes: 5 additions & 1 deletion src/IcedTasks/ValueTaskUnit.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ namespace IcedTasks
// To the extent possible under law, the author(s) have dedicated all copyright and related and neighboring rights
// to this software to the public domain worldwide. This software is distributed without any warranty.

namespace IcedTasks
namespace IcedTasks.ValueTasksUnit

open IcedTasks
open IcedTasks.TaskLike
open IcedTasks.TaskBase

/// Contains methods to build ValueTasks using the F# computation expression syntax
[<AutoOpen>]
Expand Down