@@ -206,7 +206,7 @@ type TryWith =
206
206
static member inline TryWith ( _ : unit -> ^t when ^t : null and ^t : struct , _ : exn -> 't , _ : Default1 , _ ) = ()
207
207
208
208
static member TryWith ( computation : unit -> seq < _ > , catchHandler : exn -> seq < _ > , _ : Default2 , _ ) = seq ( try ( Seq.toArray ( computation ())) with e -> Seq.toArray ( catchHandler e))
209
- static member TryWith ( computation : unit -> NonEmptySeq < _ >, catchHandler : exn -> NonEmptySeq < _ >, _ : Default2 , _ ) = seq ( try ( Seq.toArray ( computation ())) with e -> Seq.toArray ( catchHandler e)) |> NonEmptySeq.unsafeOfSeq
209
+ static member TryWith ( computation : unit -> FSharpPlus.Data. NonEmptySeq< _ >, catchHandler : exn -> FSharpPlus.Data. NonEmptySeq< _ >, _ : Default2 , _ ) = seq ( try ( Seq.toArray ( computation ())) with e -> Seq.toArray ( catchHandler e)) |> FSharpPlus.Data. NonEmptySeq.unsafeOfSeq
210
210
static member TryWith ( computation : unit -> 'R -> _ , catchHandler : exn -> 'R -> _ , _ : Default2 , _ ) = ( fun s -> try ( computation ()) s with e -> catchHandler e s) : 'R -> _
211
211
static member TryWith ( computation : unit -> Async < _ > , catchHandler : exn -> Async < _ > , _ : TryWith , _ ) = async.TryWith (( computation ()), catchHandler)
212
212
#if ! FABLE_ COMPILER
@@ -218,13 +218,40 @@ type TryWith =
218
218
let inline call ( mthd : 'M , input : unit -> 'I , _output : 'R , h : exn -> 'I ) = (( ^M or ^I ) : ( static member TryWith : _*_*_*_ -> _) input, h, mthd, False)
219
219
call ( Unchecked.defaultof< TryWith>, ( fun () -> source), Unchecked.defaultof< '`` Monad<'T> `` >, f)
220
220
221
- static member inline InvokeForStrict ( source : unit -> '``Monad < 'T > ``) ( f : exn -> '``Monad < 'T > ``) : '``Monad < 'T > `` =
221
+ static member inline InvokeForWhile ( source : '``Monad < 'T > ``) ( f : exn -> '``Monad < 'T > ``) : '``Monad < 'T > `` =
222
+ let inline call ( mthd : 'M , input : unit -> 'I , _output : 'R , h : exn -> 'I ) = (( ^M or ^I ) : ( static member TryWith : _*_*_*_ -> _) input, h, mthd, While)
223
+ call ( Unchecked.defaultof< TryWith>, ( fun () -> source), Unchecked.defaultof< '`` Monad<'T> `` >, f)
224
+
225
+
226
+ type TryWithS =
227
+ inherit Default1
228
+
229
+ [<CompilerMessage( MessageWhile , CodeWhile , IsError = false ) >]
230
+ static member TryWith ( _ : unit -> '``Monad < 'T > ``, _ : exn -> '``Monad < 'T > ``, _ : Default3 , _defaults : While ) = raise Internals.Errors.exnUnreachable
231
+
232
+ [<CompilerMessage( MessageTryWith, CodeTryWith, IsError = true ) >]
233
+ static member TryWith ( _ : unit -> '``Monad < 'T > ``, _ : exn -> '``Monad < 'T > ``, _ : Default3 , _defaults : False ) = raise Internals.Errors.exnUnreachable
234
+ static member TryWith ( computation : unit -> '``Monad < 'T > ``, catchHandler : exn -> '``Monad < 'T > ``, _ : Default3 , _defaults : True ) = try computation () with e -> catchHandler e
235
+
236
+ static member inline TryWith ( computation : unit -> '``Monad < 'T > ``, catchHandler : exn -> '``Monad < 'T > ``, _ : Default1 , _ ) = (^ `` Monad<'T> `` : ( static member TryWith : _*_ -> _) computation, catchHandler) : '`` Monad<'T> ``
237
+ static member inline TryWith ( _ : unit -> ^t when ^t : null and ^t : struct , _ : exn -> 't , _ : Default1 , _ ) = ()
238
+
239
+ static member TryWith ( computation : unit -> seq < _ > , catchHandler : exn -> seq < _ > , _ : Default2 , _ ) = seq ( try ( Seq.toArray ( computation ())) with e -> Seq.toArray ( catchHandler e))
240
+ static member TryWith ( computation : unit -> FSharpPlus.Data.NonEmptySeq < _ >, catchHandler : exn -> FSharpPlus.Data.NonEmptySeq < _ >, _ : Default2 , _ ) = seq ( try ( Seq.toArray ( computation ())) with e -> Seq.toArray ( catchHandler e)) |> FSharpPlus.Data.NonEmptySeq.unsafeOfSeq
241
+ static member TryWith ( computation : unit -> 'R -> _ , catchHandler : exn -> 'R -> _ , _ : Default2 , _ ) = ( fun s -> try ( computation ()) s with e -> catchHandler e s) : 'R -> _
242
+ static member TryWith ( computation : unit -> Async < _ > , catchHandler : exn -> Async < _ > , _ : TryWithS , _ ) = async.TryWith (( computation ()), catchHandler)
243
+ #if ! FABLE_ COMPILER
244
+ static member TryWith ( computation : unit -> Task < _ > , catchHandler : exn -> Task < _ > , _ : TryWithS , True ) = Task.tryWith computation catchHandler
245
+ #endif
246
+ static member TryWith ( computation : unit -> Lazy < _ > , catchHandler : exn -> Lazy < _ > , _ : TryWithS , _ ) = lazy ( try ( computation ()) .Force () with e -> ( catchHandler e) .Force ()) : Lazy<_>
247
+
248
+ static member inline Invoke ( source : unit -> '``Monad < 'T > ``) ( f : exn -> '``Monad < 'T > ``) : '``Monad < 'T > `` =
222
249
let inline call ( mthd : 'M , input : unit -> 'I , _output : 'R , h : exn -> 'I ) = (( ^M or ^I ) : ( static member TryWith : _*_*_*_ -> _) input, h, mthd, True)
223
- call ( Unchecked.defaultof< TryWith >, source, Unchecked.defaultof< '`` Monad<'T> `` >, f)
250
+ call ( Unchecked.defaultof< TryWithS >, source, Unchecked.defaultof< '`` Monad<'T> `` >, f)
224
251
225
252
static member inline InvokeForWhile ( source : '``Monad < 'T > ``) ( f : exn -> '``Monad < 'T > ``) : '``Monad < 'T > `` =
226
253
let inline call ( mthd : 'M , input : unit -> 'I , _output : 'R , h : exn -> 'I ) = (( ^M or ^I ) : ( static member TryWith : _*_*_*_ -> _) input, h, mthd, While)
227
- call ( Unchecked.defaultof< TryWith >, ( fun () -> source), Unchecked.defaultof< '`` Monad<'T> `` >, f)
254
+ call ( Unchecked.defaultof< TryWithS >, ( fun () -> source), Unchecked.defaultof< '`` Monad<'T> `` >, f)
228
255
229
256
230
257
type TryFinally =
0 commit comments