File tree Expand file tree Collapse file tree 5 files changed +57
-0
lines changed
src/FsToolkit.ErrorHandling Expand file tree Collapse file tree 5 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 131
131
* [ apply] ( asyncResultOption/apply.md )
132
132
* [ bind] ( asyncResultOption/bind.md )
133
133
* [ Computation Expression] ( asyncResultOption/ce.md )
134
+ * [ error] ( asyncResultOption/error.md )
134
135
* [ ignore] ( asyncResultOption/ignore.md )
135
136
* [ map] ( asyncResultOption/map.md )
136
137
* [ map2] ( asyncResultOption/map2.md )
196
197
* [ apply] ( taskResultOption/apply.md )
197
198
* [ bind] ( taskResultOption/bind.md )
198
199
* [ Computation Expression] ( taskResultOption/ce.md )
200
+ * [ error] ( taskResultOption/error.md )
199
201
* [ ignore] ( taskResultOption/ignore.md )
200
202
* [ map] ( taskResultOption/map.md )
201
203
* [ map2] ( taskResultOption/map2.md )
Original file line number Diff line number Diff line change
1
+ ## AsyncResultOption.error
2
+
3
+ Namespace: ` FsToolkit.ErrorHandling `
4
+
5
+ Lift an ` 'error ` value into an ` Async<Result<'ok option, 'error>> `
6
+
7
+ ## Function Signature:
8
+
9
+ ``` fsharp
10
+ 'error -> Async<Result<'ok option, 'error>>
11
+ ```
12
+
13
+ ## Examples
14
+
15
+ ### Example 1
16
+
17
+
18
+ ``` fsharp
19
+ let result : Async<Result<int option, string>> =
20
+ AsyncResultOption.error "Something bad happened"
21
+ ```
22
+
Original file line number Diff line number Diff line change
1
+ ## TaskResultOption.error
2
+
3
+ Namespace: ` FsToolkit.ErrorHandling `
4
+
5
+ Lift an ` 'error ` value into an ` Task<Result<'ok option, 'error>> `
6
+
7
+ ## Function Signature:
8
+
9
+ ``` fsharp
10
+ 'error -> Task<Result<'ok option, 'error>>
11
+ ```
12
+
13
+ ## Examples
14
+
15
+ ### Example 1
16
+
17
+
18
+ ``` fsharp
19
+ let result : Task<Result<int option, string>> =
20
+ TaskResultOption.error "Something bad happened"
21
+ ```
22
+
Original file line number Diff line number Diff line change @@ -24,6 +24,13 @@ module AsyncResultOption =
24
24
)
25
25
input
26
26
27
+ let inline ok x =
28
+ Ok( Some x)
29
+ |> Async.singleton
30
+
31
+ let inline error x : Async < Result < 'ok option , 'error >> =
32
+ Error x
33
+ |> Async.singleton
27
34
28
35
let inline map2
29
36
( [<InlineIfLambda>] mapper : 'okInput1 -> 'okInput2 -> 'okOutput )
Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ module TaskResultOption =
23
23
24
24
let inline singleton value = TaskResult.ok ( Some value)
25
25
26
+ let inline ok x = singleton x
27
+
28
+ let inline error x : TaskResult < 'ok option , 'error > = TaskResult.error x
29
+
26
30
let inline apply fTRO xTRO = map2 ( fun f x -> f x) fTRO xTRO
27
31
28
32
/// Replaces the wrapped value with unit
You can’t perform that action at this time.
0 commit comments