File tree 2 files changed +8
-3
lines changed
src/FsToolkit.ErrorHandling
tests/FsToolkit.ErrorHandling.Tests
2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ open FsToolkit.ErrorHandling
4
4
5
5
[<AutoOpen>]
6
6
module Validation =
7
-
8
7
let inline (<!>)
9
8
( [<InlineIfLambda>] mapper : 'okInput -> 'okOutput )
10
9
( input : Validation < 'okInput , 'error >)
@@ -28,3 +27,9 @@ module Validation =
28
27
( input : Result < 'okInput , 'error >)
29
28
: Validation < 'okOutput , 'error > =
30
29
Validation.apply applier ( Validation.ofResult input)
30
+
31
+ let inline (>>= )
32
+ ( input: Validation< 'okInput, 'error>)
33
+ ([< InlineIfLambda>] binder: 'okInput -> Validation< 'okOutput, 'error>)
34
+ : Validation< 'okOutput, 'error> =
35
+ Validation.bind binder input
Original file line number Diff line number Diff line change @@ -104,14 +104,14 @@ let applyTests =
104
104
let operatorsTests =
105
105
106
106
testList " Validation Operators Tests" [
107
- testCase " map & apply operators"
107
+ testCase " map, apply & bind operators"
108
108
<| fun _ ->
109
109
createPostRequest
110
110
<!> ( lift validLatR)
111
111
<*> ( lift validLngR)
112
112
<*> ( lift validTweetR)
113
+ >>= ( fun tweet -> Ok tweet)
113
114
|> Expect.hasOkValue validCreatePostRequest
114
-
115
115
testCase " map^ & apply^ operators"
116
116
<| fun _ ->
117
117
createPostRequest
You can’t perform that action at this time.
0 commit comments