Skip to content

Commit d6ce33b

Browse files
committed
Implement TaskValidationOp functions
1 parent 56daa09 commit d6ce33b

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed

src/FsToolkit.ErrorHandling/FsToolkit.ErrorHandling.fsproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
<Compile Include="AsyncValidation.fs" />
3434
<Compile Include="TaskValidation.fs" />
3535
<Compile Include="AsyncValidationOp.fs" />
36+
<Compile Include="TaskValidationOp.fs" />
3637
<Compile Include="AsyncValidationCE.fs" />
3738
<Compile Include="AsyncOption.fs" />
3839
<Compile Include="AsyncOptionCE.fs" />
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
namespace FsToolkit.ErrorHandling.Operator.TaskValidation
2+
3+
open FsToolkit.ErrorHandling
4+
5+
[<AutoOpen>]
6+
module TaskValidation =
7+
let inline (<!>)
8+
([<InlineIfLambda>] mapper: 'okInput -> 'okOutput)
9+
(input: TaskValidation<'okInput, 'error>)
10+
: TaskValidation<'okOutput, 'error> =
11+
TaskValidation.map mapper input
12+
13+
let inline (<!^>)
14+
([<InlineIfLambda>] mapper: 'okInput -> 'okOutput)
15+
(input: Result<'okInput, 'error>)
16+
: TaskValidation<'okOutput, 'error> =
17+
TaskValidation.map mapper (TaskValidation.ofResult input)
18+
19+
let inline (<*>)
20+
(applier: TaskValidation<('okInput -> 'okOutput), 'error>)
21+
(input: TaskValidation<'okInput, 'error>)
22+
: TaskValidation<'okOutput, 'error> =
23+
TaskValidation.apply applier input
24+
25+
let inline (<*^>)
26+
(applier: TaskValidation<('okInput -> 'okOutput), 'error>)
27+
(input: Result<'okInput, 'error>)
28+
: TaskValidation<'okOutput, 'error> =
29+
TaskValidation.apply applier (TaskValidation.ofResult input)
30+
31+
let inline (>>=)
32+
(input: TaskValidation<'okInput, 'error>)
33+
([<InlineIfLambda>] binder: 'okInput -> TaskValidation<'okOutput, 'error>)
34+
: TaskValidation<'okOutput, 'error> =
35+
TaskValidation.bind binder input

0 commit comments

Comments
 (0)