You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letbifoldBack f g (source:Validation<'Error,'T>)(state:'State):'State =
109
115
match source with
@@ -117,7 +123,7 @@ module Validation =
117
123
| Failure e -> f e x
118
124
119
125
/// Like traverse but taking an additional function to traverse the Failure part as well.
120
-
let inlinebitraverse(f:'Error1->'``Functor<'Error2>``)(g:'T1->'``Functor<'T2>``)(source:Validation<'Error1,'T1>):'``Functor<Validation<'Error2,'T2>>`` =
126
+
let inlinebitraverse(f:'TError ->'``Functor<'UError>``)(g:'T ->'``Functor<'U>``)(source:Validation<'TError,'T>):'``Functor<Validation<'UError, 'U>>`` =
121
127
match source with
122
128
| Success a -> Validation<'Error2,'T2>.Success <!> g a
123
129
| Failure e -> Validation<'Error2,'T2>.Failure <!> f e
@@ -180,11 +186,11 @@ module Validation =
180
186
letofChoice(x:Choice<'T,'Error>)=match x with Choice1Of2 a -> Success a | Choice2Of2 e -> Failure e
181
187
182
188
/// <summary> Extracts a value from either side of a Validation.</summary>
183
-
/// <param name="fSuccess">Function to be applied to source, if it contains a Success value.</param>
184
-
/// <param name="fFailure">Function to be applied to source, if it contains a Failure value.</param>
189
+
/// <param name="successMapper">Function to be applied to source, if it contains a Success value.</param>
190
+
/// <param name="failureMapper">Function to be applied to source, if it contains a Failure value.</param>
185
191
/// <param name="source">The source value, containing a Success or a Failure.</param>
186
192
/// <returns>The result of applying either functions.</returns>
187
-
leteither(fSuccess:'T->'U)(fFailure:'Error->'U)source =match source with Success v ->fSuccess v | Failure e ->fFailure e
193
+
leteither(failureMapper:'TError ->'U)(successMapper:'T ->'U)source =match source with Success v ->successMapper v | Failure e ->failureMapper e
188
194
189
195
[<System.Obsolete("This function will not be supported in future versions.")>]
190
196
letvalidate(e:'e)(p:'a ->bool)(a:'a):Validation<'e,'a>=if p a then Success a else Failure e
@@ -193,18 +199,18 @@ module Validation =
193
199
/// validationNel : Result<'a,'e> -> Validation (NonEmptyList<'e>) a
194
200
/// This is 'liftError' specialized to 'NonEmptyList', since
195
201
/// they are a common semigroup to use.
196
-
letvalidationNel(x:Result<_,_>):(Validation<NonEmptyList<'e>,'a>) =(liftResult result) x
202
+
letvalidationNel(x:Result<'T,'TError>):(Validation<NonEmptyList<'TError>, 'T>) =(liftResult result) x
197
203
#endif
198
204
199
205
[<System.Obsolete("This function will not be supported in future versions.")>]
200
206
letensure(e:'e)(p:'a->bool)=function
201
207
| Failure x -> Failure x
202
208
| Success a -> validate e p a
203
209
204
-
/// Creates a safe version of the supplied function, which returns a Validation<exn,'U> instead of throwing exceptions.
205
-
letprotect(f:'T->'U)x =
210
+
/// Creates a safe version of the supplied function, which returns a Validation<exn,'U> instead of throwing exceptions.
211
+
letprotect(unsafeFunction:'T->'U)x =
206
212
try
207
-
Success (f x)
213
+
Success (unsafeFunction x)
208
214
with e -> Failure e
209
215
210
216
#if!FABLE_COMPILER
@@ -221,7 +227,7 @@ module Validation =
221
227
/// <returns>
222
228
/// A tuple with both resulting lists, Success are in the first list.
0 commit comments