Skip to content

Commit dfcebb3

Browse files
committed
Reduce backpipe usage in src
1 parent bfc6079 commit dfcebb3

File tree

11 files changed

+46
-68
lines changed

11 files changed

+46
-68
lines changed

src/FsToolkit.ErrorHandling.JobResult/JobOptionCE.fs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ module JobOptionCE =
1010
type JobOptionBuilder() =
1111

1212
member inline _.Return(value: 'T) : Job<_ option> =
13-
job.Return
14-
<| option.Return value
13+
option.Return value
14+
|> job.Return
1515

1616
member inline _.ReturnFrom(jobResult: Job<_ option>) : Job<_ option> = jobResult
1717

1818
member inline _.Zero() : Job<_ option> =
19-
job.Return
20-
<| option.Zero()
19+
option.Zero()
20+
|> job.Return
2121

2222
member inline _.Bind
2323
(
@@ -85,10 +85,7 @@ module JobOptionCE =
8585
job.Using(resource, binder)
8686

8787
member this.While(guard: unit -> bool, computation: Job<_ option>) : Job<_ option> =
88-
if
89-
not
90-
<| guard ()
91-
then
88+
if not (guard ()) then
9289
this.Zero()
9390
else
9491
this.Bind(computation, (fun () -> this.While(guard, computation)))

src/FsToolkit.ErrorHandling.JobResult/JobResultCE.fs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ module JobResultCE =
1010
type JobResultBuilder() =
1111

1212
member inline_.Return(value: 'T) : Job<Result<'T, 'TError>> =
13-
job.Return
14-
<| result.Return value
13+
result.Return value
14+
|> job.Return
1515

1616
member inline _.ReturnFrom(jobResult: Job<Result<'T, 'TError>>) : Job<Result<'T, 'TError>> =
1717
jobResult
1818

1919
member inline_.Zero() : Job<Result<unit, 'TError>> =
20-
job.Return
21-
<| result.Zero()
20+
result.Zero()
21+
|> job.Return
2222

2323
member inline _.Bind
2424
(
@@ -85,10 +85,7 @@ module JobResultCE =
8585
guard: unit -> bool,
8686
computation: Job<Result<unit, 'TError>>
8787
) : Job<Result<unit, 'TError>> =
88-
if
89-
not
90-
<| guard ()
91-
then
88+
if not (guard ()) then
9289
this.Zero()
9390
else
9491
this.Bind(computation, (fun () -> this.While(guard, computation)))

src/FsToolkit.ErrorHandling.TaskResult/TaskOptionCE.fs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ module TaskOptionCE =
1414
member val SomeUnit = Some()
1515

1616
member inline _.Return(value: 'T) : Ply<_ option> =
17-
FSharp.Control.Tasks.Affine.Unsafe.uply.Return
18-
<| option.Return value
17+
option.Return value
18+
|> FSharp.Control.Tasks.Affine.Unsafe.uply.Return
1919

2020
member inline _.ReturnFrom(taskResult: Task<_ option>) : Ply<_ option> =
2121
FSharp.Control.Tasks.Affine.Unsafe.uply.ReturnFrom taskResult
2222

2323
member inline _.Zero() : Ply<_ option> =
24-
FSharp.Control.Tasks.Affine.Unsafe.uply.Return
25-
<| option.Zero()
24+
option.Zero()
25+
|> FSharp.Control.Tasks.Affine.Unsafe.uply.Return
2626

2727
member inline _.Bind
2828
(
@@ -146,15 +146,15 @@ module TaskOptionCE =
146146
member val SomeUnit = Some()
147147

148148
member inline _.Return(value: 'T) : Ply<_ option> =
149-
FSharp.Control.Tasks.NonAffine.Unsafe.uply.Return
150-
<| option.Return value
149+
option.Return value
150+
|> FSharp.Control.Tasks.NonAffine.Unsafe.uply.Return
151151

152152
member inline _.ReturnFrom(taskResult: Task<_ option>) : Ply<_ option> =
153153
FSharp.Control.Tasks.NonAffine.Unsafe.uply.ReturnFrom taskResult
154154

155155
member inline _.Zero() : Ply<_ option> =
156-
FSharp.Control.Tasks.NonAffine.Unsafe.uply.Return
157-
<| option.Zero()
156+
option.Zero()
157+
|> FSharp.Control.Tasks.NonAffine.Unsafe.uply.Return
158158

159159
member inline _.Bind
160160
(

src/FsToolkit.ErrorHandling.TaskResult/TaskResultCE.fs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ module TaskResultCE =
2222
FSharp.Control.Tasks.Affine.Unsafe.uply.ReturnFrom taskResult
2323

2424
member inline _.Zero() : Ply<Result<unit, 'TError>> =
25-
FSharp.Control.Tasks.Affine.Unsafe.uply.Return
26-
<| result.Zero()
25+
result.Zero()
26+
|> FSharp.Control.Tasks.Affine.Unsafe.uply.Return
2727

2828
member inline _.Bind
2929
(
@@ -34,8 +34,8 @@ module TaskResultCE =
3434
match r with
3535
| Ok x -> binder x
3636
| Error x ->
37-
FSharp.Control.Tasks.Affine.Unsafe.uply.Return
38-
<| Error x
37+
Error x
38+
|> FSharp.Control.Tasks.Affine.Unsafe.uply.Return
3939

4040
FSharp.Control.Tasks.Affine.Unsafe.uply.Bind(taskResult, binder')
4141

@@ -162,8 +162,9 @@ module TaskResultCE =
162162
FSharp.Control.Tasks.NonAffine.Unsafe.uply.ReturnFrom taskResult
163163

164164
member inline _.Zero() : Ply<Result<unit, 'TError>> =
165-
FSharp.Control.Tasks.NonAffine.Unsafe.uply.Return
166-
<| result.Zero()
165+
result.Zero()
166+
|> FSharp.Control.Tasks.NonAffine.Unsafe.uply.Return
167+
167168

168169
member inline _.Bind
169170
(
@@ -174,8 +175,9 @@ module TaskResultCE =
174175
match r with
175176
| Ok x -> binder x
176177
| Error x ->
177-
FSharp.Control.Tasks.NonAffine.Unsafe.uply.Return
178-
<| Error x
178+
Error x
179+
|> FSharp.Control.Tasks.NonAffine.Unsafe.uply.Return
180+
179181

180182
FSharp.Control.Tasks.NonAffine.Unsafe.uply.Bind(taskResult, binder')
181183

src/FsToolkit.ErrorHandling.TaskResult/TaskResultOptionCE.fs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ module TaskResultOptionCE =
1313
#if NETSTANDARD2_0
1414
type TaskResultOptionBuilder() =
1515
member inline _.Return(value: 'T) : Ply<Result<'T option, 'TError>> =
16-
uply.Return
17-
<| result.Return(Some value)
16+
result.Return(Some value)
17+
|> uply.Return
1818

1919
member inline _.ReturnFrom
2020
(taskResult: Task<Result<'T option, 'TError>>)
@@ -30,11 +30,11 @@ module TaskResultOptionCE =
3030
match r with
3131
| Ok (Some x) -> binder x
3232
| Ok None ->
33-
uply.Return
34-
<| Ok None
33+
Ok None
34+
|> uply.Return
3535
| Error x ->
36-
uply.Return
37-
<| Error x
36+
Error x
37+
|> uply.Return
3838

3939
uply.Bind(taskResult, binder')
4040

src/FsToolkit.ErrorHandling/AsyncOptionCE.fs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ module AsyncOptionCE =
1212
member inline _.ReturnFrom(value: Async<'value option>) : Async<'value option> = value
1313

1414
member inline _.Zero() : Async<unit option> =
15-
async.Return
16-
<| option.Zero()
15+
option.Zero()
16+
|> async.Return
1717

1818
member inline _.Bind
1919
(
@@ -54,10 +54,7 @@ module AsyncOptionCE =
5454
this.TryFinally(
5555
(binder resource),
5656
(fun () ->
57-
if
58-
not
59-
<| obj.ReferenceEquals(resource, null)
60-
then
57+
if not (obj.ReferenceEquals(resource, null)) then
6158
resource.Dispose()
6259
)
6360
)
@@ -67,10 +64,7 @@ module AsyncOptionCE =
6764
guard: unit -> bool,
6865
computation: Async<unit option>
6966
) : Async<unit option> =
70-
if
71-
not
72-
<| guard ()
73-
then
67+
if not (guard ()) then
7468
this.Zero()
7569
else
7670
this.Bind(computation, (fun () -> this.While(guard, computation)))

src/FsToolkit.ErrorHandling/AsyncResultCE.fs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ module AsyncResultCE =
99
type AsyncResultBuilder() =
1010

1111
member inline _.Return(value: 'ok) : Async<Result<'ok, 'error>> =
12-
async.Return
13-
<| result.Return value
12+
result.Return value
13+
|> async.Return
1414

1515
member inline _.ReturnFrom
1616
(asyncResult: Async<Result<'ok, 'error>>)
1717
: Async<Result<'ok, 'error>> =
1818
asyncResult
1919

2020
member inline _.Zero() : Async<Result<unit, 'error>> =
21-
async.Return
22-
<| result.Zero()
21+
result.Zero()
22+
|> async.Return
2323

2424
member inline _.Bind
2525
(

src/FsToolkit.ErrorHandling/OptionCE.fs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,7 @@ module OptionCE =
6363
this.TryFinally(
6464
(fun () -> binder resource),
6565
(fun () ->
66-
if
67-
not
68-
<| obj.ReferenceEquals(resource, null)
69-
then
66+
if not (obj.ReferenceEquals(resource, null)) then
7067
resource.Dispose()
7168
)
7269
)

src/FsToolkit.ErrorHandling/ResultCE.fs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ module ResultCE =
6464
this.TryFinally(
6565
(fun () -> binder resource),
6666
(fun () ->
67-
if
68-
not
69-
<| obj.ReferenceEquals(resource, null)
70-
then
67+
if not (obj.ReferenceEquals(resource, null)) then
7168
resource.Dispose()
7269
)
7370
)

src/FsToolkit.ErrorHandling/ValidationCE.fs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,7 @@ module ValidationCE =
6464
this.TryFinally(
6565
(fun () -> binder resource),
6666
(fun () ->
67-
if
68-
not
69-
<| obj.ReferenceEquals(resource, null)
70-
then
67+
if not (obj.ReferenceEquals(resource, null)) then
7168
resource.Dispose()
7269
)
7370
)

0 commit comments

Comments
 (0)