Skip to content

Commit c52349c

Browse files
committed
cleanups
1 parent 77c8b9d commit c52349c

File tree

9 files changed

+50
-62
lines changed

9 files changed

+50
-62
lines changed
Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2-
3-
<PropertyGroup>
4-
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
5-
<ImplicitUsings>enable</ImplicitUsings>
6-
<Nullable>enable</Nullable>
7-
<IsPackable>false</IsPackable>
8-
</PropertyGroup>
9-
10-
11-
</Project>
2+
<PropertyGroup>
3+
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
4+
<ImplicitUsings>enable</ImplicitUsings>
5+
<Nullable>enable</Nullable>
6+
<IsPackable>false</IsPackable>
7+
</PropertyGroup>
8+
</Project>

benchmarks/FSharpBenchmarks/benchmarks.fsproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@
2323
</ItemGroup>
2424
<ItemGroup>
2525
<PackageReference Include="BenchmarkDotNet" />
26-
<PackageReference Include="Ply"/>
26+
<PackageReference Include="Ply" />
2727
</ItemGroup>
28-
</Project>
28+
</Project>

build/build.fsproj

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<Project Sdk="Microsoft.NET.Sdk">
32
<PropertyGroup>
43
<OutputType>Exe</OutputType>
@@ -11,7 +10,6 @@
1110
<Compile Include="Changelog.fs" />
1211
<Compile Include="build.fs" />
1312
</ItemGroup>
14-
1513
<ItemGroup>
1614
<PackageReference Include="Argu" />
1715
<PackageReference Include="Fake.IO.FileSystem" />
@@ -25,7 +23,6 @@
2523
<PackageReference Include="Fake.Api.GitHub" />
2624
<PackageReference Include="Fake.BuildServer.GitHubActions" />
2725
<PackageReference Include="Octokit" />
28-
<PackageReference Include="MSBuild.StructuredLogger"/>
29-
26+
<PackageReference Include="MSBuild.StructuredLogger" />
3027
</ItemGroup>
31-
</Project>
28+
</Project>

src/IcedTasks/AsyncEx.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type AsyncEx =
3939
// the task may not have a cancellation token at all).
4040
onError e
4141

42-
Async.FromContinuations(fun (onNext, onError, onCancel) ->
42+
Async.FromContinuations(fun (onNext, onError, _onCancel) ->
4343
if Awaiter.IsCompleted awaiter then
4444
handleFinished (onNext, onError, awaiter)
4545
else

src/IcedTasks/CancellableTask.fs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,11 +160,11 @@ module CancellableTasks =
160160
let left = left ct
161161
let right = right ct
162162

163-
(this.Bind(
163+
this.Bind(
164164
left,
165165
fun leftR ->
166166
this.BindReturn(right, (fun rightR -> struct (leftR, rightR)))
167-
))
167+
)
168168
)
169169
)
170170
)
@@ -180,11 +180,11 @@ module CancellableTasks =
180180
fun ct ->
181181
let right = right ct
182182

183-
(this.Bind(
183+
this.Bind(
184184
left,
185185
fun leftR ->
186186
this.BindReturn(right, (fun rightR -> struct (leftR, rightR)))
187-
))
187+
)
188188
)
189189
)
190190
)
@@ -201,11 +201,11 @@ module CancellableTasks =
201201
fun ct ->
202202
let left = left ct
203203

204-
(this.Bind(
204+
this.Bind(
205205
left,
206206
fun leftR ->
207207
this.BindReturn(right, (fun rightR -> struct (leftR, rightR)))
208-
))
208+
)
209209
)
210210
)
211211
)

src/IcedTasks/TaskBuilderBase.fs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,10 @@ module TaskBase =
150150
/// <returns>a Task that executes computation and compensation afterwards or
151151
/// when an exception is raised.</returns>
152152
member inline _.TryFinally
153-
(computation: TaskBaseCode<'TOverall, 'T, 'Builder>, compensation: unit -> unit)
154-
: TaskBaseCode<'TOverall, 'T, 'Builder> =
153+
(
154+
computation: TaskBaseCode<'TOverall, 'T, 'Builder>,
155+
[<InlineIfLambda>] compensation: unit -> unit
156+
) : TaskBaseCode<'TOverall, 'T, 'Builder> =
155157
ResumableCode.TryFinally(
156158
computation,
157159
ResumableCode<_, _>(fun _ ->
@@ -173,10 +175,10 @@ module TaskBase =
173175
) : bool =
174176

175177
let cont =
176-
(TaskBaseResumptionFunc<'TOverall, 'Builder>(fun sm ->
178+
TaskBaseResumptionFunc<'TOverall, 'Builder>(fun sm ->
177179
let result = Awaiter.GetResult awaiter
178180
(continuation result).Invoke(&sm)
179-
))
181+
)
180182

181183
// shortcut to continue immediately
182184
if Awaiter.IsCompleted awaiter then
@@ -277,7 +279,7 @@ module TaskBase =
277279
) : TaskBaseCode<'TOverall, 'T, 'Builder> =
278280
ResumableCode.TryFinallyAsync(
279281
computation,
280-
ResumableCode<_, _>(fun sm -> x.Bind((compensation ()), (x.Zero)).Invoke(&sm))
282+
ResumableCode<_, _>(fun sm -> x.Bind(compensation (), x.Zero).Invoke(&sm))
281283
)
282284

283285
/// <summary>Creates a Task that runs binder(resource).
@@ -311,30 +313,26 @@ module TaskBase =
311313
)
312314

313315
member inline internal x.WhileAsync
314-
([<InlineIfLambda>] condition: unit -> 'Awaitable, body: TaskBaseCode<_, unit, 'Builder>) : TaskBaseCode<
315-
_,
316-
_,
317-
'Builder
318-
>
319-
=
316+
( // Fantomas ignore
317+
[<InlineIfLambda>] condition: unit -> 'Awaitable,
318+
body: TaskBaseCode<_, unit, 'Builder>
319+
) : TaskBaseCode<_, _, 'Builder> =
320320
let mutable condition_res = true
321321

322322
x.While(
323323
(fun () -> condition_res),
324324
ResumableCode<_, _>(fun sm ->
325325
x
326326
.Bind(
327-
(condition ()),
327+
condition (),
328328
(fun result ->
329-
condition_res <- result
330-
331329
ResumableCode<_, _>(fun sm ->
330+
condition_res <- result
332331
if condition_res then body.Invoke(&sm) else true
333332
)
334333
)
335334
)
336335
.Invoke(&sm)
337-
338336
)
339337
)
340338

@@ -346,7 +344,10 @@ module TaskBase =
346344
source.GetAsyncEnumerator CancellationToken.None,
347345
(fun (e: IAsyncEnumerator<'T>) ->
348346
this.WhileAsync(
349-
(fun () -> Awaitable.GetAwaiter(e.MoveNextAsync())),
347+
(fun () ->
348+
__debugPoint "ForLoop.InOrToKeyword"
349+
Awaitable.GetAwaiter(e.MoveNextAsync())
350+
),
350351
(fun sm -> (body e.Current).Invoke(&sm))
351352
)
352353
)
Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<Project Sdk="Microsoft.NET.Sdk">
32
<PropertyGroup>
43
<OutputType>Exe</OutputType>
54
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
65
<GenerateProgramFile>false</GenerateProgramFile>
7-
<DefineConstants>$(DefineConstants);NETSTANDARD2_0;TEST_NETSTANDARD2_0</DefineConstants>
6+
<DefineConstants>$(DefineConstants);NETSTANDARD2_0;TEST_NETSTANDARD2_0</DefineConstants>
87
</PropertyGroup>
9-
<ItemGroup>
10-
<ProjectReference Include="../../src/IcedTasks/IcedTasks.fsproj" AdditionalProperties="TargetFramework=netstandard2.0" />
11-
</ItemGroup>
8+
<ItemGroup>
9+
<ProjectReference Include="../../src/IcedTasks/IcedTasks.fsproj" AdditionalProperties="TargetFramework=netstandard2.0" />
10+
</ItemGroup>
1211
<ItemGroup>
1312
<Compile Include="../IcedTasks.Tests/Expect.fs" />
1413
<Compile Include="../IcedTasks.Tests/AsyncExTests.fs" />
@@ -23,10 +22,7 @@
2322
<Compile Include="../IcedTasks.Tests/ParallelAsyncTests.fs" />
2423
<Compile Include="../IcedTasks.Tests/Main.fs" />
2524
</ItemGroup>
26-
2725
<ItemGroup>
28-
29-
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces"/>
26+
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" />
3027
</ItemGroup>
31-
32-
</Project>
28+
</Project>

tests/IcedTasks.Tests.NS21/IcedTasks.Tests.NS21.fsproj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<Project Sdk="Microsoft.NET.Sdk">
32
<PropertyGroup>
43
<OutputType>Exe</OutputType>
54
<TargetFrameworks>net9.0;net8.0;</TargetFrameworks>
65
<GenerateProgramFile>false</GenerateProgramFile>
76
<DefineConstants>$(DefineConstants);NETSTANDARD2_1;TEST_NETSTANDARD2_1</DefineConstants>
87
</PropertyGroup>
9-
<ItemGroup>
10-
<ProjectReference Include="../../src/IcedTasks/IcedTasks.fsproj" AdditionalProperties="TargetFramework=netstandard2.1" />
11-
</ItemGroup>
8+
<ItemGroup>
9+
<ProjectReference Include="../../src/IcedTasks/IcedTasks.fsproj" AdditionalProperties="TargetFramework=netstandard2.1" />
10+
</ItemGroup>
1211
<ItemGroup>
1312
<Compile Include="../IcedTasks.Tests/Expect.fs" />
1413
<Compile Include="../IcedTasks.Tests/AsyncExTests.fs" />
@@ -23,5 +22,4 @@
2322
<Compile Include="../IcedTasks.Tests/ParallelAsyncTests.fs" />
2423
<Compile Include="../IcedTasks.Tests/Main.fs" />
2524
</ItemGroup>
26-
27-
</Project>
25+
</Project>

tests/IcedTasks.Tests/IcedTasks.Tests.fsproj

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
<?xml version="1.0" encoding="utf-8"?>
21
<Project Sdk="Microsoft.NET.Sdk">
32
<PropertyGroup>
43
<OutputType>Exe</OutputType>
54
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
65
<GenerateProgramFile>false</GenerateProgramFile>
76
<DefineConstants>$(DefineConstants);TEST_NET6_0_OR_GREATER</DefineConstants>
87
</PropertyGroup>
9-
<ItemGroup >
10-
<ProjectReference Include="../../src/IcedTasks/IcedTasks.fsproj" />
11-
</ItemGroup>
8+
<ItemGroup>
9+
<ProjectReference Include="../../src/IcedTasks/IcedTasks.fsproj" />
10+
</ItemGroup>
1211
<ItemGroup>
1312
<Compile Include="Expect.fs" />
1413
<Compile Include="AsyncExTests.fs" />
@@ -25,5 +24,5 @@
2524
<Compile Include="ColdTaskTests.fs" />
2625
<Compile Include="ParallelAsyncTests.fs" />
2726
<Compile Include="Main.fs" />
28-
</ItemGroup>
29-
</Project>
27+
</ItemGroup>
28+
</Project>

0 commit comments

Comments
 (0)