From dffb26b04c1010d0580bd74c70838ff236377933 Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Fri, 28 Oct 2022 20:00:48 +0200
Subject: [PATCH 1/6] Add explicit type parameter to tryParse
---
src/FSharpPlus/Operators.fs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/FSharpPlus/Operators.fs b/src/FSharpPlus/Operators.fs
index 1879be141..695d5cc15 100644
--- a/src/FSharpPlus/Operators.fs
+++ b/src/FSharpPlus/Operators.fs
@@ -1373,7 +1373,7 @@ module Operators =
/// Converts to a value from its string representation. Returns None if the convertion doesn't succeed.
///
/// Converter
- let inline tryParse (value: string) = TryParse.Invoke value
+ let inline tryParse< ^T when (TryParse or ^T) : (static member TryParse: ^T * TryParse -> (string -> ^T option))> (value: string) : 'T option = TryParse.Invoke value
// Numerics
From 4b42d312a0391c7c759c9094c7794ae4dd6c9267 Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Fri, 28 Oct 2022 20:47:53 +0200
Subject: [PATCH 2/6] Add explicit type parameter to parse
---
src/FSharpPlus/Operators.fs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/FSharpPlus/Operators.fs b/src/FSharpPlus/Operators.fs
index 695d5cc15..51cfd0d11 100644
--- a/src/FSharpPlus/Operators.fs
+++ b/src/FSharpPlus/Operators.fs
@@ -1367,7 +1367,7 @@ module Operators =
/// Converts to a value from its string representation.
///
/// Converter
- let inline parse (value: string) = Parse.Invoke value
+ let inline parse< ^T when (Control.Parse or ^T) : (static member Parse: ^T * Control.Parse -> (string -> ^T))> (value: string) : 'T = Parse.Invoke value
///
/// Converts to a value from its string representation. Returns None if the convertion doesn't succeed.
From 30356a7657af7d9a7bb25bcc6ff119f4f8dbc5c7 Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Fri, 28 Oct 2022 21:34:07 +0200
Subject: [PATCH 3/6] Add explicit type parameter to ofByte functions
---
src/FSharpPlus/Operators.fs | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/FSharpPlus/Operators.fs b/src/FSharpPlus/Operators.fs
index 51cfd0d11..4263c309a 100644
--- a/src/FSharpPlus/Operators.fs
+++ b/src/FSharpPlus/Operators.fs
@@ -1333,19 +1333,19 @@ module Operators =
/// Convert from a byte array value, given options of little-endian, and startIndex
///
/// Converter
- let inline ofBytesWithOptions (isLtEndian: bool) (startIndex: int) (value: byte[]) = OfBytes.Invoke isLtEndian startIndex value
+ let inline ofBytesWithOptions< ^T when (OfBytes or ^T) : (static member OfBytes: ^T * OfBytes -> (byte[] * int * bool -> ^T))> (isLtEndian: bool) (startIndex: int) (value: byte[]) : 'T = OfBytes.Invoke isLtEndian startIndex value
///
/// Convert from a byte array value, assuming little-endian
///
/// Converter
- let inline ofBytes (value: byte[]) = OfBytes.Invoke true 0 value
+ let inline ofBytes< ^T when (OfBytes or ^T) : (static member OfBytes: ^T * OfBytes -> (byte[] * int * bool -> ^T))> (value: byte[]) : 'T = OfBytes.Invoke true 0 value
///
/// Convert from a byte array value, assuming big-endian
///
/// Converter
- let inline ofBytesBE (value: byte[]) = OfBytes.Invoke false 0 value
+ let inline ofBytesBE< ^T when (OfBytes or ^T) : (static member OfBytes: ^T * OfBytes -> (byte[] * int * bool -> ^T))> (value: byte[]) : 'T = OfBytes.Invoke false 0 value
///
/// Convert to a byte array value, assuming little endian
@@ -1367,7 +1367,7 @@ module Operators =
/// Converts to a value from its string representation.
///
/// Converter
- let inline parse< ^T when (Control.Parse or ^T) : (static member Parse: ^T * Control.Parse -> (string -> ^T))> (value: string) : 'T = Parse.Invoke value
+ let inline parse< ^T when (Parse or ^T) : (static member Parse: ^T * Parse -> (string -> ^T))> (value: string) : 'T = Parse.Invoke value
///
/// Converts to a value from its string representation. Returns None if the convertion doesn't succeed.
From 4cf4bffd32c5c1a0bbe5bce18f1ece9d2c3c1802 Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Sat, 29 Oct 2022 00:32:04 +0200
Subject: [PATCH 4/6] Add explicit type parameter to plus, Seq.sum and guard
---
src/FSharpPlus/Operators.fs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/FSharpPlus/Operators.fs b/src/FSharpPlus/Operators.fs
index 4263c309a..48d919b6f 100644
--- a/src/FSharpPlus/Operators.fs
+++ b/src/FSharpPlus/Operators.fs
@@ -294,7 +294,7 @@ module Operators =
/// Combines two monoids in one.
///
/// Monoid
- let inline plus (x: 'Monoid) (y: 'Monoid) : 'Monoid = Plus.Invoke x y
+ let inline plus< ^Monoid when (Plus or ^Monoid) : (static member ``+`` : ^Monoid * ^Monoid * Plus -> ^Monoid)> (x: 'Monoid) (y: 'Monoid) : 'Monoid = Plus.Invoke x y
module Seq =
@@ -302,7 +302,7 @@ module Operators =
/// Folds all values in the sequence using the monoidal addition.
///
/// Monoid
- let inline sum (x: seq<'Monoid>) : 'Monoid = Sum.Invoke x
+ let inline sum< ^Monoid when (Sum or seq<^Monoid> or ^Monoid) : (static member Sum: seq<^Monoid> * ^Monoid * Sum -> ^Monoid)> (x: seq<'Monoid>) : 'Monoid = Sum.Invoke x
// Alternative/Monadplus/Arrowplus ----------------------------------------
@@ -333,7 +333,9 @@ module Operators =
/// Common uses of guard include conditionally signaling an error in an error monad and conditionally rejecting the current choice in an Alternative-based parser.
///
/// Alternative/Monadplus/Arrowplus
- let inline guard x: '``MonadPlus`` = if x then Return.Invoke () else Empty.Invoke ()
+ let inline guard< ^``MonadPlus`` when (Return or ^``MonadPlus``) :
+ (static member Return: ^``MonadPlus`` * Return -> (unit -> ^``MonadPlus``)) and
+ (Empty or ^``MonadPlus``) : (static member Empty: ^``MonadPlus`` * Empty -> ^``MonadPlus``)> x : '``MonadPlus`` = if x then Return.Invoke () else Empty.Invoke ()
// Contravariant/Bifunctor/Profunctor/Invariant ---------------------------
From 366565cac055e45d5e579b9ed347d9104970a8be Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Sun, 30 Oct 2022 00:56:09 +0200
Subject: [PATCH 5/6] Remove hat
---
src/FSharpPlus/Operators.fs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/FSharpPlus/Operators.fs b/src/FSharpPlus/Operators.fs
index 48d919b6f..45e4bc3ce 100644
--- a/src/FSharpPlus/Operators.fs
+++ b/src/FSharpPlus/Operators.fs
@@ -302,7 +302,7 @@ module Operators =
/// Folds all values in the sequence using the monoidal addition.
///
/// Monoid
- let inline sum< ^Monoid when (Sum or seq<^Monoid> or ^Monoid) : (static member Sum: seq<^Monoid> * ^Monoid * Sum -> ^Monoid)> (x: seq<'Monoid>) : 'Monoid = Sum.Invoke x
+ let inline sum< ^Monoid when (Sum or seq<^Monoid> or ^Monoid) : (static member Sum: seq<'Monoid> * 'Monoid * Sum -> 'Monoid)> (x: seq<'Monoid>) : 'Monoid = Sum.Invoke x
// Alternative/Monadplus/Arrowplus ----------------------------------------
From d9d836272ce1b72452241193cbd0a2cdf412c465 Mon Sep 17 00:00:00 2001
From: Gustavo Leon <1261319+gusty@users.noreply.github.com>
Date: Sun, 30 Oct 2022 01:23:47 +0200
Subject: [PATCH 6/6] Insert space
---
src/FSharpPlus/Operators.fs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/FSharpPlus/Operators.fs b/src/FSharpPlus/Operators.fs
index 45e4bc3ce..ed15d84b0 100644
--- a/src/FSharpPlus/Operators.fs
+++ b/src/FSharpPlus/Operators.fs
@@ -302,7 +302,7 @@ module Operators =
/// Folds all values in the sequence using the monoidal addition.
///
/// Monoid
- let inline sum< ^Monoid when (Sum or seq<^Monoid> or ^Monoid) : (static member Sum: seq<'Monoid> * 'Monoid * Sum -> 'Monoid)> (x: seq<'Monoid>) : 'Monoid = Sum.Invoke x
+ let inline sum< ^Monoid when (Sum or seq< ^Monoid> or ^Monoid) : (static member Sum: seq<'Monoid> * 'Monoid * Sum -> 'Monoid)> (x: seq<'Monoid>) : 'Monoid = Sum.Invoke x
// Alternative/Monadplus/Arrowplus ----------------------------------------