Skip to content

Commit fb350c3

Browse files
committed
Formatting
1 parent 2bd3f23 commit fb350c3

File tree

17 files changed

+100
-61
lines changed

17 files changed

+100
-61
lines changed

src/FsToolkit.ErrorHandling.JobResult/JobOptionCE.fs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -84,19 +84,20 @@ module JobOptionCE =
8484
) : Job<_ option> =
8585
job.Using(resource, binder)
8686

87-
member this.While(guard: unit -> bool, computation: Job<_ option>) : Job<_ option> =
88-
job {
89-
let mutable doContinue = true
90-
let mutable result = Some ()
91-
while doContinue && guard () do
92-
match! computation with
93-
| Some () -> ()
94-
| None ->
95-
doContinue <- false
96-
result <- None
97-
return result
87+
member this.While(guard: unit -> bool, computation: Job<_ option>) : Job<_ option> = job {
88+
let mutable doContinue = true
89+
let mutable result = Some()
9890

99-
}
91+
while doContinue && guard () do
92+
match! computation with
93+
| Some () -> ()
94+
| None ->
95+
doContinue <- false
96+
result <- None
97+
98+
return result
99+
100+
}
100101

101102
member inline this.For
102103
(

src/FsToolkit.ErrorHandling.JobResult/JobResultCE.fs

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -80,19 +80,20 @@ module JobResultCE =
8080
) : Job<Result<'U, 'TError>> =
8181
job.Using(resource, binder)
8282

83-
member this.While(guard: unit -> bool, computation: Job<Result<unit, 'TError>>) : Job<Result<unit, 'TError>> =
84-
job {
85-
let mutable doContinue = true
86-
let mutable result = Ok ()
87-
while doContinue && guard () do
88-
match! computation with
89-
| Ok () -> ()
90-
| Error e ->
91-
doContinue <- false
92-
result <- Error e
93-
return result
83+
member this.While(guard: unit -> bool, computation: Job<Result<unit, 'TError>>) : Job<Result<unit, 'TError>> = job {
84+
let mutable doContinue = true
85+
let mutable result = Ok()
9486

95-
}
87+
while doContinue && guard () do
88+
match! computation with
89+
| Ok () -> ()
90+
| Error e ->
91+
doContinue <- false
92+
result <- Error e
93+
94+
return result
95+
96+
}
9697

9798
member inline this.For
9899
(

src/FsToolkit.ErrorHandling/OptionCE.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ module OptionCE =
7575
) : unit option =
7676

7777
let mutable doContinue = true
78-
let mutable result = Some ()
78+
let mutable result = Some()
79+
7980
while doContinue && guard () do
8081
match generator () with
8182
| Some () -> ()
8283
| None ->
8384
doContinue <- false
8485
result <- None
86+
8587
result
8688

8789
member inline this.For

src/FsToolkit.ErrorHandling/ResultCE.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,15 @@ module ResultCE =
7676
) : Result<unit, 'error> =
7777

7878
let mutable doContinue = true
79-
let mutable result = Ok ()
79+
let mutable result = Ok()
80+
8081
while doContinue && guard () do
8182
match generator () with
8283
| Ok () -> ()
8384
| Error e ->
8485
doContinue <- false
8586
result <- Error e
87+
8688
result
8789

8890
member inline this.For

src/FsToolkit.ErrorHandling/ValidationCE.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ module ValidationCE =
7575
[<InlineIfLambda>] generator: unit -> Validation<unit, 'error>
7676
) : Validation<unit, 'error> =
7777
let mutable doContinue = true
78-
let mutable result = Ok ()
78+
let mutable result = Ok()
79+
7980
while doContinue && guard () do
8081
match generator () with
8182
| Ok () -> ()
8283
| Error e ->
8384
doContinue <- false
8485
result <- Error e
86+
8587
result
8688

8789
member inline this.For

src/FsToolkit.ErrorHandling/ValueOptionCE.fs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,15 @@ module ValueOptionCE =
7474
) : _ voption =
7575

7676
let mutable doContinue = true
77-
let mutable result = ValueSome ()
77+
let mutable result = ValueSome()
78+
7879
while doContinue && guard () do
7980
match generator () with
8081
| ValueSome () -> ()
8182
| ValueNone ->
8283
doContinue <- false
8384
result <- ValueNone
85+
8486
result
8587

8688
member inline this.For

tests/FsToolkit.ErrorHandling.JobResult.Tests/JobOptionCE.fs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,11 @@ let ceTests =
227227
Expect.equal actual (Some data) "Should be ok"
228228
}
229229
yield! [
230-
let maxIndices = [10; 1000000]
230+
let maxIndices = [ 10; 1000000 ]
231+
231232
for maxIndex in maxIndices do
232-
testCaseJob <| sprintf "While - %i" maxIndex
233+
testCaseJob
234+
<| sprintf "While - %i" maxIndex
233235
<| job {
234236
let data = 42
235237
let mutable index = 0

tests/FsToolkit.ErrorHandling.JobResult.Tests/JobResultCE.fs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -290,9 +290,11 @@ let ``JobResultCE using Tests`` =
290290
let ``JobResultCE loop Tests`` =
291291
testList "JobResultCE loop Tests" [
292292
yield! [
293-
let maxIndices = [10; 1000000]
293+
let maxIndices = [ 10; 1000000 ]
294+
294295
for maxIndex in maxIndices do
295-
testCaseJob <| sprintf "While - %i" maxIndex
296+
testCaseJob
297+
<| sprintf "While - %i" maxIndex
296298
<| job {
297299
let data = 42
298300
let mutable index = 0

tests/FsToolkit.ErrorHandling.TaskResult.Tests/BackgroundTaskResultCE.fs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,10 +349,12 @@ let ``BackgroundTaskResultCE using Tests`` =
349349
let ``BackgroundTaskResultCE loop Tests`` =
350350
testList "BackgroundTaskResultCE loop Tests" [
351351
yield! [
352-
let maxIndices = [10; 1000000]
352+
let maxIndices = [ 10; 1000000 ]
353+
353354
for maxIndex in maxIndices do
354-
testCaseTask <| sprintf "While - %i" maxIndex
355-
<| fun () -> backgroundTask {
355+
testCaseTask
356+
<| sprintf "While - %i" maxIndex
357+
<| fun () -> backgroundTask {
356358
let data = 42
357359
let mutable index = 0
358360

@@ -365,7 +367,7 @@ let ``BackgroundTaskResultCE loop Tests`` =
365367

366368
Expect.equal index maxIndex "Index should reach maxIndex"
367369
Expect.equal actual (Ok data) "Should be ok"
368-
}
370+
}
369371
]
370372
testCaseTask "while fail"
371373
<| fun () -> backgroundTask {

tests/FsToolkit.ErrorHandling.TaskResult.Tests/TaskOptionCE.fs

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -282,10 +282,12 @@ let ceTests =
282282
Expect.equal actual (Some data) "Should be ok"
283283
}
284284
yield! [
285-
let maxIndices = [10; 1000000]
285+
let maxIndices = [ 10; 1000000 ]
286+
286287
for maxIndex in maxIndices do
287-
testCaseTask <| sprintf "While - %i" maxIndex
288-
<| fun () -> task {
288+
testCaseTask
289+
<| sprintf "While - %i" maxIndex
290+
<| fun () -> task {
289291
let data = 42
290292
let mutable index = 0
291293

@@ -298,11 +300,16 @@ let ceTests =
298300

299301
Expect.equal index maxIndex "Index should reach maxIndex"
300302
Expect.equal actual (Some data) "Should be ok"
301-
}
303+
}
302304
]
303305

304-
testCaseTask "while bind error" <| fun () -> task {
305-
let items = [TaskOption.some 3 ; TaskOption.some 4; Task.singleton (None)]
306+
testCaseTask "while bind error"
307+
<| fun () -> task {
308+
let items = [
309+
TaskOption.some 3
310+
TaskOption.some 4
311+
Task.singleton (None)
312+
]
306313

307314
let mutable index = 0
308315

@@ -313,9 +320,10 @@ let ceTests =
313320

314321
return index
315322
}
323+
316324
Expect.equal index (items.Length - 1) "Index should reach maxIndex"
317325
Expect.equal actual (None) "Should be NOPE"
318-
}
326+
}
319327
testCaseTask "while fail"
320328
<| fun () -> task {
321329

0 commit comments

Comments
 (0)