From 617c0097e7fd12ef2faf9d7e6d6a73dc09584c88 Mon Sep 17 00:00:00 2001 From: Oskar Gewalli Date: Mon, 11 Nov 2024 19:16:42 +0200 Subject: [PATCH] #IF NET45 ... --- src/FSharpPlus/Control/Functor.fs | 9 ++++++++- src/FSharpPlus/Extensions/ResizeArray.fs | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/FSharpPlus/Control/Functor.fs b/src/FSharpPlus/Control/Functor.fs index 5622c4a9c..43c9cba4b 100644 --- a/src/FSharpPlus/Control/Functor.fs +++ b/src/FSharpPlus/Control/Functor.fs @@ -41,7 +41,14 @@ type Iterate = #else static member Iterate (x: Async<'T> , action: 'T -> unit) = (x |> Async.map action |> Async.AsTask).Wait () #endif - static member Iterate (x: Result<'T, 'E> , action) = Result.iter action x + static member Iterate (x: Result<'T, 'E> , action) = + #if !NET45 + Result.iter action x + #else + match x with + | Error _ -> () + | Ok value -> action value + #endif static member Iterate (x: Choice<'T, 'E> , action) = match x with Choice1Of2 x -> action x | _ -> () static member Iterate (KeyValue(_: 'Key, x: 'T), action) = action x : unit static member Iterate (x: Map<'Key,'T> , action) = Map.iter (const' action) x diff --git a/src/FSharpPlus/Extensions/ResizeArray.fs b/src/FSharpPlus/Extensions/ResizeArray.fs index 28364353b..c00370291 100644 --- a/src/FSharpPlus/Extensions/ResizeArray.fs +++ b/src/FSharpPlus/Extensions/ResizeArray.fs @@ -27,7 +27,9 @@ module ResizeArray = /// The function to apply to elements from the input ResizeArray. /// The input ResizeArray. let iter (action: 'T -> 'U) (source: ResizeArray<'T>) = + #if !NET45 raiseIfNull (nameof source) source + #endif ResizeArray (Seq.map action source)