From 466d3e1aa5bb81df471c64ef27d8d0910b79621b Mon Sep 17 00:00:00 2001 From: gusty <1261319+gusty@users.noreply.github.com> Date: Sat, 14 Oct 2023 22:12:35 +0200 Subject: [PATCH 1/5] Make parse return a UTC DateTime Otherwise it will depend on the local machine, you can always convert it to Local afterwards if desired. --- src/FSharpPlus/Control/Converter.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FSharpPlus/Control/Converter.fs b/src/FSharpPlus/Control/Converter.fs index 5cf8fa41c..f0d88dae8 100644 --- a/src/FSharpPlus/Control/Converter.fs +++ b/src/FSharpPlus/Control/Converter.fs @@ -164,7 +164,7 @@ type Parse = static member Parse (_: DateTime , _: Parse) = fun (x:string) -> match DateTime.TryParseExact (x, [|"yyyy-MM-ddTHH:mm:ss.fffZ"; "yyyy-MM-ddTHH:mm:ssZ"|], null, DateTimeStyles.RoundtripKind) with | true, x -> x - | _ -> DateTime.Parse (x, CultureInfo.InvariantCulture) + | _ -> DateTime.Parse (x, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal) static member Parse (_: DateTimeOffset, _: Parse) = fun (x:string) -> try DateTimeOffset.ParseExact (x, [|"yyyy-MM-ddTHH:mm:ss.fffK"; "yyyy-MM-ddTHH:mm:ssK"|], null, DateTimeStyles.AssumeUniversal) From b2f3c8cef8c42160f6ed7b12b70c08b94545531a Mon Sep 17 00:00:00 2001 From: gusty <1261319+gusty@users.noreply.github.com> Date: Sun, 15 Oct 2023 06:36:24 +0200 Subject: [PATCH 2/5] + Functions for IList and IReadOnlyList --- src/FSharpPlus/Extensions/IList.fs | 9 ++++++++- src/FSharpPlus/Extensions/IReadOnlyList.fs | 11 ++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/FSharpPlus/Extensions/IList.fs b/src/FSharpPlus/Extensions/IList.fs index f05ba64f5..641e1e74c 100644 --- a/src/FSharpPlus/Extensions/IList.fs +++ b/src/FSharpPlus/Extensions/IList.fs @@ -1,6 +1,5 @@ namespace FSharpPlus -#if !FABLE_COMPILER /// Additional operations IList<'T> [] @@ -9,9 +8,17 @@ module IList = open System.Collections.ObjectModel open System.Collections.Generic +#if !FABLE_COMPILER /// Converts an IList to an IReadOnlyList (from System.Collections.Generic). /// The System.Collections.Generic.IList /// The list converted to a System.Collections.Generic.IReadOnlyList let toIReadOnlyList (source: IList<_>) = ReadOnlyCollection source :> IReadOnlyList<_> #endif + + let ofArray (source: 'T[] ) = source :> IList<'T> + let ofList (source: 'T list) = source |> Array.ofList :> IList<'T> + let ofSeq (source: seq<'T>) = source |> Array.ofSeq :> IList<'T> + let map mapping (source: IList<'T>) = Seq.map mapping source |> Seq.toArray :> IList<'U> + let iter mapping (source: IList<'T>) = Seq.iter mapping source + diff --git a/src/FSharpPlus/Extensions/IReadOnlyList.fs b/src/FSharpPlus/Extensions/IReadOnlyList.fs index b0910bf58..e4ad6c2c2 100644 --- a/src/FSharpPlus/Extensions/IReadOnlyList.fs +++ b/src/FSharpPlus/Extensions/IReadOnlyList.fs @@ -8,7 +8,11 @@ module IReadOnlyList = #if !FABLE_COMPILER let ofArray (source: 'T array) = IList.toIReadOnlyList source + let ofList (source: 'T list) = source |> Array.ofList |> IList.toIReadOnlyList + let ofSeq (source: seq<'T>) = source |> Array.ofSeq |> IList.toIReadOnlyList + #endif + let toArray (source: IReadOnlyList<'T>) = Array.ofSeq source #if !FABLE_COMPILER @@ -19,8 +23,13 @@ module IReadOnlyList = if 0 <= i && i < source.Count then source |> Array.ofSeq |> setNth i value |> ofArray |> Some else None + + let map mapping (source: IReadOnlyList<'T>) : IReadOnlyList<'U> = Seq.map mapping source |> Seq.toArray |> IList.toIReadOnlyList + #endif let tryItem i (source: IReadOnlyList<_>) = if 0 <= i && i < source.Count then Some source.[i] - else None \ No newline at end of file + else None + + let iter mapping (source: IReadOnlyList<'T>) = Seq.iter mapping source \ No newline at end of file From 020eb23dc23df51b0d254e226f03072a717accae Mon Sep 17 00:00:00 2001 From: gusty <1261319+gusty@users.noreply.github.com> Date: Sun, 15 Oct 2023 07:14:43 +0200 Subject: [PATCH 3/5] Remove xml docs from deprecated functions --- src/FSharpPlus/Operators.fs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/FSharpPlus/Operators.fs b/src/FSharpPlus/Operators.fs index 0501efa6a..dc5b296af 100644 --- a/src/FSharpPlus/Operators.fs +++ b/src/FSharpPlus/Operators.fs @@ -185,7 +185,6 @@ module Operators = let inline lift2 (f: 'T->'U->'V) (x: '``Applicative<'T>``) (y: '``Applicative<'U>``) : '``Applicative<'V>`` = Lift2.Invoke f x y [] - /// Applicative let inline liftA2 (f: 'T->'U->'V) (x: '``Applicative<'T>``) (y: '``Applicative<'U>``) : '``Applicative<'V>`` = lift2 f x y /// @@ -207,11 +206,9 @@ module Operators = let inline (<* ) (x: '``Applicative<'U>``) (y: '``Applicative<'T>``) : '``Applicative<'U>`` = ((fun (k: 'U) (_: 'T) -> k ) x : '``Applicative<'T->'U>``) <*> y [) instead.")>] - /// Applicative let inline (<**>) (x: '``Applicative<'T>``) : '``Applicative<'T -> 'U>``->'``Applicative<'U>`` = flip (<*>) x [] - /// Applicative let inline optional v = Some v result None /// From 16878b65b32e74a093ce495ed11670ef5d813d61 Mon Sep 17 00:00:00 2001 From: gusty <1261319+gusty@users.noreply.github.com> Date: Sun, 15 Oct 2023 07:52:02 +0200 Subject: [PATCH 4/5] Make tryParse return a UTC DateTime --- src/FSharpPlus/Control/Converter.fs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FSharpPlus/Control/Converter.fs b/src/FSharpPlus/Control/Converter.fs index f0d88dae8..aff56e6f6 100644 --- a/src/FSharpPlus/Control/Converter.fs +++ b/src/FSharpPlus/Control/Converter.fs @@ -116,7 +116,7 @@ type TryParse = match DateTime.TryParseExact (x, [|"yyyy-MM-ddTHH:mm:ss.fffZ"; "yyyy-MM-ddTHH:mm:ssZ"|], null, DateTimeStyles.RoundtripKind) with | true, x -> Some x | _ -> - match DateTime.TryParse (x, CultureInfo.InvariantCulture, DateTimeStyles.None) with + match DateTime.TryParse (x, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal) with | true, x -> Some x | _ -> None From 1a5e5959f47142baf0257500a3ef42f007f93897 Mon Sep 17 00:00:00 2001 From: gusty <1261319+gusty@users.noreply.github.com> Date: Sun, 15 Oct 2023 10:05:04 +0200 Subject: [PATCH 5/5] Release notes for 1.5.0 --- RELEASE_NOTES.md | 8 ++++++++ RELEASE_NOTES.txt | 13 +++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md index 6d9f8749e..7dbc33bf2 100644 --- a/RELEASE_NOTES.md +++ b/RELEASE_NOTES.md @@ -1,3 +1,11 @@ +#### 1.5.0 - October 15 2023 + - Support for Fable 4 (some functions had to be removed from Fable in order to it) + - More IList and IReadOnlyList functions + - Bug fixes in parse, tryParse, seq's TryFinally and (=>>) for ValueTask + - Add Free.hoist + - Add distinct for NonEmptySeq and NonEmptyList + - Add ValueOption.ofOption and Task.result for Task and ValueTask + #### 1.4.0 - February 22 2023 - Additional Alternatives available (functions, error monads) - More IReadOnlyDictionary functions diff --git a/RELEASE_NOTES.txt b/RELEASE_NOTES.txt index f52bfae92..fe7ac53b6 100644 --- a/RELEASE_NOTES.txt +++ b/RELEASE_NOTES.txt @@ -1,8 +1,9 @@ -Release Notes for FSharpPlus 1.4.0 - February 22 2023 +Release Notes for FSharpPlus 1.5.0 - October 15 2023 ------------------------------------------------------ -Additional Alternatives available (functions, error monads) -More IReadOnlyDictionary functions -Bug fixes in Map as FoldIndexable and missing <*> for IDictionary and IReadOnlyDictionary -Deprecate IReadOnlyDictionary.map -Guid to/from bytes conversion \ No newline at end of file +Support for Fable 4 (some functions had to be removed from Fable in order to it) +More IList and IReadOnlyList functions +Bug fixes in parse, tryParse, seq's TryFinally and (=>>) for ValueTask +Add Free.hoist +Add distinct for NonEmptySeq and NonEmptyList +Add ValueOption.ofOption and Task.result for Task and ValueTask \ No newline at end of file